From 89096416679bcdf9bd0ff3183181ae6ee37dfd1f Mon Sep 17 00:00:00 2001 From: Marcus Weaver Date: Sat, 13 Oct 2018 23:26:44 +0300 Subject: [PATCH 01/35] Ctor without parameters --- .../src/main/resources/csharp/api.mustache | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/csharp/api.mustache b/modules/openapi-generator/src/main/resources/csharp/api.mustache index 4f0a06f234e..cdbb940d3f5 100644 --- a/modules/openapi-generator/src/main/resources/csharp/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/api.mustache @@ -93,6 +93,17 @@ namespace {{packageName}}.{{apiPackage}} ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public {{classname}}() + { + this.Configuration = {{packageName}}.Client.Configuration.Default; + + ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object From dcde12ac07b62e2e248089faec5360d426b61b24 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 18 Oct 2018 11:29:52 +0800 Subject: [PATCH 02/35] Add "tomplus" to Python technical committee (#1264) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bdb4d625e2e..2117ebd0d2d 100644 --- a/README.md +++ b/README.md @@ -668,7 +668,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Perl | @wing328 (2017/07) | | PHP | @jebentier (2017/07) @dkarlovi (2017/07) @mandrean (2017/08) @jfastnacht (2017/09) @ackintosh (2017/09) @ybelenko (2018/07) | | PowerShell | | -| Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11)| +| Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) | | R | | | Ruby | @cliffano (2017/07) @zlx (2017/09) | | Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) | From c1afba71940ace713b3a88d472d1798a6e0d661a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 18 Oct 2018 16:29:38 +0800 Subject: [PATCH 03/35] Fix jackson-databind security issue (#1259) * fix jackson databind security issue * fix java jersey 1 dependency * fix java webclient dep --- .../resources/Groovy/build.gradle.mustache | 7 +++-- .../main/resources/Java/build.gradle.mustache | 5 +-- .../libraries/feign/build.gradle.mustache | 5 +-- .../Java/libraries/feign/build.sbt.mustache | 7 +++-- .../Java/libraries/feign/pom.mustache | 5 +-- .../google-api-client/build.gradle.mustache | 5 +-- .../google-api-client/build.sbt.mustache | 6 ++-- .../libraries/google-api-client/pom.mustache | 3 +- .../libraries/jersey2/build.gradle.mustache | 5 +-- .../Java/libraries/jersey2/build.sbt.mustache | 6 ++-- .../Java/libraries/jersey2/pom.mustache | 5 +-- .../libraries/resteasy/build.gradle.mustache | 13 +++----- .../libraries/resteasy/build.sbt.mustache | 31 +++++++++---------- .../Java/libraries/resteasy/pom.mustache | 5 +-- .../resttemplate/build.gradle.mustache | 5 +-- .../Java/libraries/resttemplate/pom.mustache | 5 +-- .../libraries/retrofit2/build.gradle.mustache | 3 +- .../libraries/retrofit2/build.sbt.mustache | 6 ++-- .../Java/libraries/retrofit2/pom.mustache | 2 +- .../Java/libraries/vertx/pom.mustache | 2 +- .../Java/libraries/webclient/pom.mustache | 7 +++-- .../src/main/resources/undertow/pom.mustache | 5 +-- samples/client/petstore/groovy/build.gradle | 7 +++-- .../client/petstore/java/feign/build.gradle | 5 +-- samples/client/petstore/java/feign/build.sbt | 7 +++-- samples/client/petstore/java/feign/pom.xml | 5 +-- .../petstore/java/feign10x/build.gradle | 5 +-- .../client/petstore/java/feign10x/build.sbt | 7 +++-- samples/client/petstore/java/feign10x/pom.xml | 5 +-- .../java/google-api-client/build.gradle | 5 +-- .../petstore/java/google-api-client/build.sbt | 6 ++-- .../petstore/java/google-api-client/pom.xml | 3 +- .../client/petstore/java/jersey1/build.gradle | 3 +- .../petstore/java/jersey2-java6/build.sbt | 6 ++-- .../petstore/java/jersey2-java6/pom.xml | 5 +-- .../petstore/java/jersey2-java8/build.gradle | 5 +-- .../petstore/java/jersey2-java8/build.sbt | 6 ++-- .../petstore/java/jersey2-java8/pom.xml | 5 +-- .../client/petstore/java/jersey2/build.gradle | 5 +-- .../client/petstore/java/jersey2/build.sbt | 6 ++-- samples/client/petstore/java/jersey2/pom.xml | 5 +-- .../petstore/java/resteasy/build.gradle | 13 +++----- .../client/petstore/java/resteasy/build.sbt | 25 +++++++-------- samples/client/petstore/java/resteasy/pom.xml | 5 +-- .../java/resttemplate-withXml/build.gradle | 5 +-- .../java/resttemplate-withXml/pom.xml | 5 +-- .../petstore/java/resttemplate/build.gradle | 5 +-- .../client/petstore/java/resttemplate/pom.xml | 5 +-- .../java/retrofit2-play26/build.gradle | 3 +- .../petstore/java/retrofit2-play26/build.sbt | 6 ++-- .../petstore/java/retrofit2-play26/pom.xml | 2 +- .../petstore/java/webclient/build.gradle | 5 +-- .../client/petstore/java/webclient/pom.xml | 5 +-- 53 files changed, 177 insertions(+), 151 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Groovy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Groovy/build.gradle.mustache index 2d8af263e08..5864228124d 100644 --- a/modules/openapi-generator/src/main/resources/Groovy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Groovy/build.gradle.mustache @@ -24,8 +24,9 @@ repositories { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.0" + swagger_annotations_version = "1.5.21" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" } dependencies { @@ -34,7 +35,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" - compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" + compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_databind_version" compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:2.1.5" compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' } diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 192ac3cbbbc..cd79a9afd36 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -133,7 +133,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.17" - jackson_version = "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" + jackson_version = "{{^threetenbp}}2.8.11{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" + jackson_databind_version = "{{^threetenbp}}2.8.11.2{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" jersey_version = "1.19.4" jodatime_version = "2.9.9" junit_version = "4.12" @@ -145,7 +146,7 @@ dependencies { compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" {{#joda}} compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index b852a3d43af..59bb9c3906d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -119,7 +119,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.7" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" {{#threetenbp}} threepane_version = "2.6.4" {{/threetenbp}} @@ -137,7 +138,7 @@ dependencies { compile "io.github.openfeign.form:feign-form:$feign_form_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" {{#joda}} compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache index f5c8355a02b..0ab575007dd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -14,10 +14,11 @@ lazy val root = (project in file(".")). "io.github.openfeign" % "feign-jackson" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile", "io.github.openfeign" % "feign-slf4j" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile", "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.8.7" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "junit" % "junit" % "4.12" % "test", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index 32f01e5bb12..abf00bbfaaf 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -235,7 +235,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#withXml}} @@ -302,7 +302,8 @@ 1.5.21 {{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}} 2.1.0 - 2.8.9 + 2.8.11 + 2.8.11.2 {{#threetenbp}} 2.6.4 {{/threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index acbe24a53f6..99c91a9c771 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -119,7 +119,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" google_api_client_version = "1.23.0" jersey_common_version = "2.25.1" jodatime_version = "2.9.9" @@ -135,7 +136,7 @@ dependencies { compile "org.glassfish.jersey.core:jersey-common:${jersey_common_version}" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" {{#java8}} compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache index 9f1aeaf1570..ba6d1f459d0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache @@ -12,9 +12,9 @@ lazy val root = (project in file(".")). "io.swagger" % "swagger-annotations" % "1.5.21", "com.google.api-client" % "google-api-client" % "1.23.0", "org.glassfish.jersey.core" % "jersey-common" % "2.25.1", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", {{#withXml}} "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.8.9" % "compile", {{/withXml}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache index 7ff969e9c6c..2dffd4837bb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache @@ -295,7 +295,8 @@ 1.5.21 1.23.0 2.25.1 - 2.8.9 + 2.8.11 + 2.8.11.2 {{#joda}} 2.9.9 {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 2a4a56b935c..46167d5f8d9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -118,7 +118,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.9.6" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" {{#supportJava6}} jersey_version = "2.6" commons_io_version=2.5 @@ -140,7 +141,7 @@ dependencies { compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" {{#joda}} compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index cc2e9480b6a..035cce0e3ce 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -13,9 +13,9 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, "org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, "org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", {{#joda}} "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.9" % "compile", {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 57db33547c4..a912ac6edf4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -251,7 +251,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#withXml}} @@ -332,7 +332,8 @@ 2.5 3.6 {{/supportJava6}} - 2.8.9 + 2.8.11 + 2.8.11.2 {{#threetenbp}} 2.6.4 {{/threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index ac2cb6fab8e..7f8e2422642 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -117,13 +117,13 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.18" - jackson_version = "2.8.6" + swagger_annotations_version = "1.5.21" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" threetenbp_version = "2.6.4" - jersey_version = "2.22.2" resteasy_version = "3.1.3.Final" {{^java8}} - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" {{/java8}} {{#supportJava6}} commons_io_version=2.5 @@ -137,12 +137,9 @@ dependencies { compile "org.jboss.resteasy:resteasy-client:$resteasy_version" compile "org.jboss.resteasy:resteasy-multipart-provider:$resteasy_version" compile "org.jboss.resteasy:resteasy-jackson2-provider:$resteasy_version" - compile "org.glassfish.jersey.core:jersey-client:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" {{#java8}} compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache index cdfc4f848fd..7b197b46f8e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache @@ -9,28 +9,25 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.18", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final", - "org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final", - "org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.6", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.6", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.6", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", + "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", {{#java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.6", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.6" % "compile", {{/java8}} {{^java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", - "com.brsanthu" % "migbase64" % "2.2", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", {{/java8}} {{#supportJava6}} - "org.apache.commons" % "commons-lang3" % "3.5", - "commons-io" % "commons-io" % "2.5", + "org.apache.commons" % "commons-lang3" % "3.5" % "compile", + "commons-io" % "commons-io" % "2.5" % "compile", {{/supportJava6}} "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index 2950d3e748e..c474027a274 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -187,7 +187,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#withXml}} @@ -266,7 +266,8 @@ UTF-8 1.5.21 3.1.3.Final - 2.8.6 + 2.8.11 + 2.8.11 2.6.4 {{^java8}} 2.9.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index b50203a337a..d1110e419d2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -119,7 +119,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" junit_version = "4.12" @@ -133,7 +134,7 @@ dependencies { compile "org.springframework:spring-web:$spring_web_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" {{#java8}} compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache index 95b3f7cb5d0..427a815cf4e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -241,7 +241,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.fasterxml.jackson.jaxrs @@ -297,7 +297,8 @@ UTF-8 1.5.21 4.3.9.RELEASE - 2.8.9 + 2.8.11 + 2.8.11.2 {{#joda}} 2.9.9 {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index dfd1f6d9405..93518d88941 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -130,7 +130,8 @@ ext { play_version = "2.5.14" {{/play25}} {{#play26}} - jackson_version = "2.8.10" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11" play_version = "2.6.7" {{/play26}} {{/usePlayWS}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache index e66ca784036..88e06d154b8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache @@ -30,9 +30,9 @@ lazy val root = (project in file(".")). {{#play26}} "com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile", "javax.validation" % "validation-api" % "1.1.0.Final" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.10" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.10" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", {{/play26}} "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", {{/usePlayWS}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache index 29347aee8e6..4ddee4d014f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -363,7 +363,7 @@ 2.5.15 {{/play25}} {{#play26}} - 2.8.10 + 2.8.11 2.6.7 {{/play26}} {{/usePlayWS}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache index 46687cd0c7c..2b922cbcccb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache @@ -277,7 +277,7 @@ UTF-8 3.4.2 1.5.21 - {{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}} + {{^threetenbp}}2.8.11{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}} 4.12 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache index 7fde2317697..bdd59fd4772 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache @@ -96,7 +96,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#java8}} @@ -131,12 +131,13 @@ UTF-8 1.5.20 5.0.7.RELEASE - 2.9.5 + 2.8.11 + 2.8.11.2 4.12 3.1.8.RELEASE 0.7.8.RELEASE {{#joda}} - 2.9.9 + 2.9.9 {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/undertow/pom.mustache b/modules/openapi-generator/src/main/resources/undertow/pom.mustache index c3c1e51d95d..2faeb6f1ddf 100644 --- a/modules/openapi-generator/src/main/resources/undertow/pom.mustache +++ b/modules/openapi-generator/src/main/resources/undertow/pom.mustache @@ -16,7 +16,8 @@ 1.8 UTF-8 0.1.1 - 2.8.2 + 2.8.11 + 2.8.11.2 1.7.21 0.5.2 4.5.3 @@ -80,7 +81,7 @@ com.fasterxml.jackson.core jackson-databind - ${version.jackson} + ${version.jackson.databind} com.fasterxml.jackson.core diff --git a/samples/client/petstore/groovy/build.gradle b/samples/client/petstore/groovy/build.gradle index 2d8af263e08..a95db7cb74b 100644 --- a/samples/client/petstore/groovy/build.gradle +++ b/samples/client/petstore/groovy/build.gradle @@ -24,8 +24,9 @@ repositories { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.0" + swagger_annotations_version = "1.5.21" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" } dependencies { @@ -33,7 +34,7 @@ dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:2.1.5" compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index e2126b12432..5485465b943 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -95,7 +95,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.7" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" threepane_version = "2.6.4" feign_version = "9.4.0" feign_form_version = "2.1.0" @@ -111,7 +112,7 @@ dependencies { compile "io.github.openfeign.form:feign-form:$feign_form_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threepane_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" compile "com.brsanthu:migbase64:2.2" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index b387ad56e61..0b723fe5b8e 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -14,10 +14,11 @@ lazy val root = (project in file(".")). "io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile", "io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile", "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.7" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "junit" % "junit" % "4.12" % "test", diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index 58b7d4d7e0e..bd0ad3b0c7e 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -228,7 +228,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.github.joschi.jackson @@ -269,7 +269,8 @@ 1.5.21 9.4.0 2.1.0 - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 4.12 1.0.0 diff --git a/samples/client/petstore/java/feign10x/build.gradle b/samples/client/petstore/java/feign10x/build.gradle index fb153ad6e2b..2fc42df758d 100644 --- a/samples/client/petstore/java/feign10x/build.gradle +++ b/samples/client/petstore/java/feign10x/build.gradle @@ -95,7 +95,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.7" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" threepane_version = "2.6.4" feign_version = "10.0.1" feign_form_version = "2.1.0" @@ -111,7 +112,7 @@ dependencies { compile "io.github.openfeign.form:feign-form:$feign_form_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threepane_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" compile "com.brsanthu:migbase64:2.2" diff --git a/samples/client/petstore/java/feign10x/build.sbt b/samples/client/petstore/java/feign10x/build.sbt index 89fecfb0655..d114d8bf871 100644 --- a/samples/client/petstore/java/feign10x/build.sbt +++ b/samples/client/petstore/java/feign10x/build.sbt @@ -14,10 +14,11 @@ lazy val root = (project in file(".")). "io.github.openfeign" % "feign-jackson" % "10.0.1" % "compile", "io.github.openfeign" % "feign-slf4j" % "10.0.1" % "compile", "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.7" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "junit" % "junit" % "4.12" % "test", diff --git a/samples/client/petstore/java/feign10x/pom.xml b/samples/client/petstore/java/feign10x/pom.xml index 6ff244e2384..1b23ad0edde 100644 --- a/samples/client/petstore/java/feign10x/pom.xml +++ b/samples/client/petstore/java/feign10x/pom.xml @@ -228,7 +228,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.github.joschi.jackson @@ -269,7 +269,8 @@ 1.5.21 10.0.1 2.1.0 - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 4.12 1.0.0 diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index 97de036a9ce..eb70ed0779b 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -95,7 +95,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" google_api_client_version = "1.23.0" jersey_common_version = "2.25.1" jodatime_version = "2.9.9" @@ -109,7 +110,7 @@ dependencies { compile "org.glassfish.jersey.core:jersey-common:${jersey_common_version}" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/google-api-client/build.sbt b/samples/client/petstore/java/google-api-client/build.sbt index 7052571b29f..5264a6a4b89 100644 --- a/samples/client/petstore/java/google-api-client/build.sbt +++ b/samples/client/petstore/java/google-api-client/build.sbt @@ -12,9 +12,9 @@ lazy val root = (project in file(".")). "io.swagger" % "swagger-annotations" % "1.5.21", "com.google.api-client" % "google-api-client" % "1.23.0", "org.glassfish.jersey.core" % "jersey-common" % "2.25.1", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/google-api-client/pom.xml b/samples/client/petstore/java/google-api-client/pom.xml index af558ebb155..db84d6a643c 100644 --- a/samples/client/petstore/java/google-api-client/pom.xml +++ b/samples/client/petstore/java/google-api-client/pom.xml @@ -247,7 +247,8 @@ 1.5.21 1.23.0 2.25.1 - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index 54a5f0626a5..78028b0bc91 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -110,6 +110,7 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.17" jackson_version = "2.6.4" + jackson_databind_version = "2.6.4" jersey_version = "1.19.4" jodatime_version = "2.9.9" junit_version = "4.12" @@ -121,7 +122,7 @@ dependencies { compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version" compile "com.brsanthu:migbase64:2.2" diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index ea742941dcd..a2c4df6876f 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -13,9 +13,9 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.core" % "jersey-client" % "2.6", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.6", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.6", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "com.brsanthu" % "migbase64" % "2.2", "org.apache.commons" % "commons-lang3" % "3.6", diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index eea08b8d535..b84bbc0505f 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -232,7 +232,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.github.joschi.jackson @@ -269,7 +269,8 @@ 2.6 2.5 3.6 - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index d2daa9fa14a..00ba4fae091 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -94,7 +94,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.9.6" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" jersey_version = "2.27" junit_version = "4.12" } @@ -106,7 +107,7 @@ dependencies { compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index 8edfce668ab..9a3b0f82f6a 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -13,9 +13,9 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index 70130e62c2a..e16c2bf4ae3 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -232,7 +232,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.fasterxml.jackson.datatype @@ -251,7 +251,8 @@ UTF-8 1.5.21 2.27 - 2.8.9 + 2.8.11 + 2.8.11.2 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2/build.gradle index 84f8976c2ca..58e8ab8949e 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2/build.gradle @@ -94,7 +94,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.9.6" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" jersey_version = "2.27" junit_version = "4.12" threetenbp_version = "2.6.4" @@ -107,7 +108,7 @@ dependencies { compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" compile "com.brsanthu:migbase64:2.2" testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/jersey2/build.sbt b/samples/client/petstore/java/jersey2/build.sbt index e3f30385eff..4c15437bfd7 100644 --- a/samples/client/petstore/java/jersey2/build.sbt +++ b/samples/client/petstore/java/jersey2/build.sbt @@ -13,9 +13,9 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "com.brsanthu" % "migbase64" % "2.2", "junit" % "junit" % "4.12" % "test", diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index 94391c45448..6bc59664032 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -232,7 +232,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.github.joschi.jackson @@ -257,7 +257,8 @@ UTF-8 1.5.21 2.27 - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index 86e77bee641..99816611b64 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -93,12 +93,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.18" - jackson_version = "2.8.6" + swagger_annotations_version = "1.5.21" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" threetenbp_version = "2.6.4" - jersey_version = "2.22.2" resteasy_version = "3.1.3.Final" - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" junit_version = "4.12" } @@ -107,12 +107,9 @@ dependencies { compile "org.jboss.resteasy:resteasy-client:$resteasy_version" compile "org.jboss.resteasy:resteasy-multipart-provider:$resteasy_version" compile "org.jboss.resteasy:resteasy-jackson2-provider:$resteasy_version" - compile "org.glassfish.jersey.core:jersey-client:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" compile "joda-time:joda-time:$jodatime_version" diff --git a/samples/client/petstore/java/resteasy/build.sbt b/samples/client/petstore/java/resteasy/build.sbt index 166b7b91f8a..4eb7cefafb4 100644 --- a/samples/client/petstore/java/resteasy/build.sbt +++ b/samples/client/petstore/java/resteasy/build.sbt @@ -9,20 +9,17 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.18", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final", - "org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final", - "org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.6", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.6", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.6", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", - "com.brsanthu" % "migbase64" % "2.2", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", + "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index de50c2bb944..db6c7c610a8 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -168,7 +168,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.fasterxml.jackson.datatype @@ -215,7 +215,8 @@ UTF-8 1.5.21 3.1.3.Final - 2.8.6 + 2.8.11 + 2.8.11 2.6.4 2.9.9 1.0.0 diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index 6448e545d59..0e1d8ccb6ab 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -95,7 +95,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" junit_version = "4.12" @@ -107,7 +108,7 @@ dependencies { compile "org.springframework:spring-web:$spring_web_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" diff --git a/samples/client/petstore/java/resttemplate-withXml/pom.xml b/samples/client/petstore/java/resttemplate-withXml/pom.xml index 74cc0d02f02..1f0441681fb 100644 --- a/samples/client/petstore/java/resttemplate-withXml/pom.xml +++ b/samples/client/petstore/java/resttemplate-withXml/pom.xml @@ -222,7 +222,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.fasterxml.jackson.jaxrs @@ -255,7 +255,8 @@ UTF-8 1.5.21 4.3.9.RELEASE - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index 17325018007..d7a11fbaa56 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -95,7 +95,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" junit_version = "4.12" @@ -107,7 +108,7 @@ dependencies { compile "org.springframework:spring-web:$spring_web_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index d3a526022dd..23389e12e65 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -222,7 +222,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.fasterxml.jackson.jaxrs @@ -247,7 +247,8 @@ UTF-8 1.5.21 4.3.9.RELEASE - 2.8.9 + 2.8.11 + 2.8.11.2 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle index dd9ded7db04..f7763a7b2ff 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.gradle +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -96,7 +96,8 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" - jackson_version = "2.8.10" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11" play_version = "2.6.7" swagger_annotations_version = "1.5.21" junit_version = "4.12" diff --git a/samples/client/petstore/java/retrofit2-play26/build.sbt b/samples/client/petstore/java/retrofit2-play26/build.sbt index 6ef49aa26d9..ab402fb616f 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.sbt +++ b/samples/client/petstore/java/retrofit2-play26/build.sbt @@ -13,9 +13,9 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", "com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile", "javax.validation" % "validation-api" % "1.1.0.Final" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.8.10" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.10" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.11.2" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", diff --git a/samples/client/petstore/java/retrofit2-play26/pom.xml b/samples/client/petstore/java/retrofit2-play26/pom.xml index 6957bc7ec62..6eaabdbc3eb 100644 --- a/samples/client/petstore/java/retrofit2-play26/pom.xml +++ b/samples/client/petstore/java/retrofit2-play26/pom.xml @@ -278,7 +278,7 @@ ${java.version} 1.8.0 1.5.21 - 2.8.10 + 2.8.11 2.6.7 2.3.0 1.3.5 diff --git a/samples/client/petstore/java/webclient/build.gradle b/samples/client/petstore/java/webclient/build.gradle index 4839efb7764..06ed43f0d6e 100644 --- a/samples/client/petstore/java/webclient/build.gradle +++ b/samples/client/petstore/java/webclient/build.gradle @@ -109,7 +109,8 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.5.17" - jackson_version = "2.8.9" + jackson_version = "2.8.11" + jackson_databind_version = "2.8.11.2" jersey_version = "1.19.4" jodatime_version = "2.9.9" junit_version = "4.12" @@ -121,7 +122,7 @@ dependencies { compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/webclient/pom.xml b/samples/client/petstore/java/webclient/pom.xml index 9af35e5b212..a57b0370bbb 100644 --- a/samples/client/petstore/java/webclient/pom.xml +++ b/samples/client/petstore/java/webclient/pom.xml @@ -89,7 +89,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} @@ -110,7 +110,8 @@ UTF-8 1.5.20 5.0.7.RELEASE - 2.9.5 + 2.8.11 + 2.8.11.2 4.12 3.1.8.RELEASE 0.7.8.RELEASE From 16f1fc073947d80785cd5abf685bdcaaffcffc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bresson?= Date: Thu, 18 Oct 2018 14:58:28 +0200 Subject: [PATCH 04/35] Consider callbacks in unused schemas (#1232) --- .../codegen/utils/ModelUtils.java | 100 +++++++++++++----- .../codegen/utils/ModelUtilsTest.java | 10 +- .../src/test/resources/3_0/unusedSchemas.yaml | 47 +++++++- 3 files changed, 127 insertions(+), 30 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 7182ea67cbe..4a1dd19ee60 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -20,6 +20,7 @@ package org.openapitools.codegen.utils; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.BinarySchema; @@ -167,40 +168,56 @@ public class ModelUtils { if (paths != null) { for (PathItem path : paths.values()) { - List allOperations = path.readOperations(); - if (allOperations != null) { - for (Operation operation : allOperations) { - //Params: - if (operation.getParameters() != null) { - for (Parameter p : operation.getParameters()) { - Parameter parameter = getReferencedParameter(openAPI, p); - if (parameter.getSchema() != null) { - visitSchema(openAPI, parameter.getSchema(), null, visitedSchemas, visitor); - } - } - } + visitPathItem(path, openAPI, visitor, visitedSchemas); + } + } + } - //RequestBody: - RequestBody requestBody = getReferencedRequestBody(openAPI, operation.getRequestBody()); - if (requestBody != null && requestBody.getContent() != null) { - for (Entry e : requestBody.getContent().entrySet()) { + private static void visitPathItem(PathItem pathItem, OpenAPI openAPI, OpenAPISchemaVisitor visitor, List visitedSchemas) { + List allOperations = pathItem.readOperations(); + if (allOperations != null) { + for (Operation operation : allOperations) { + //Params: + if (operation.getParameters() != null) { + for (Parameter p : operation.getParameters()) { + Parameter parameter = getReferencedParameter(openAPI, p); + if (parameter.getSchema() != null) { + visitSchema(openAPI, parameter.getSchema(), null, visitedSchemas, visitor); + } + } + } + + //RequestBody: + RequestBody requestBody = getReferencedRequestBody(openAPI, operation.getRequestBody()); + if (requestBody != null && requestBody.getContent() != null) { + for (Entry e : requestBody.getContent().entrySet()) { + if (e.getValue().getSchema() != null) { + visitSchema(openAPI, e.getValue().getSchema(), e.getKey(), visitedSchemas, visitor); + } + } + } + + //Responses: + if (operation.getResponses() != null) { + for (ApiResponse r : operation.getResponses().values()) { + ApiResponse apiResponse = getReferencedApiResponse(openAPI, r); + if (apiResponse != null && apiResponse.getContent() != null) { + for (Entry e : apiResponse.getContent().entrySet()) { if (e.getValue().getSchema() != null) { visitSchema(openAPI, e.getValue().getSchema(), e.getKey(), visitedSchemas, visitor); } } } + } + } - //Responses: - if (operation.getResponses() != null) { - for (ApiResponse r : operation.getResponses().values()) { - ApiResponse apiResponse = getReferencedApiResponse(openAPI, r); - if (apiResponse != null && apiResponse.getContent() != null) { - for (Entry e : apiResponse.getContent().entrySet()) { - if (e.getValue().getSchema() != null) { - visitSchema(openAPI, e.getValue().getSchema(), e.getKey(), visitedSchemas, visitor); - } - } - } + //Callbacks: + if (operation.getCallbacks() != null) { + for (Callback c : operation.getCallbacks().values()) { + Callback callback = getReferencedCallback(openAPI, c); + if (callback != null) { + for (PathItem p : callback.values()) { + visitPathItem(p, openAPI, visitor, visitedSchemas); } } } @@ -603,6 +620,35 @@ public class ModelUtils { return null; } + /** + * If a Callback contains a reference to an other Callback with '$ref', returns the referenced Callback if it is found or the actual Callback in the other cases. + * + * @param openAPI specification being checked + * @param callback potentially containing a '$ref' + * @return callback without '$ref' + */ + public static Callback getReferencedCallback(OpenAPI openAPI, Callback callback) { + if (callback != null && StringUtils.isNotEmpty(callback.get$ref())) { + String name = getSimpleRef(callback.get$ref()); + Callback referencedCallback = getCallback(openAPI, name); + if (referencedCallback != null) { + return referencedCallback; + } + } + return callback; + } + + public static Callback getCallback(OpenAPI openAPI, String name) { + if (name == null) { + return null; + } + + if (openAPI != null && openAPI.getComponents() != null && openAPI.getComponents().getCallbacks() != null) { + return openAPI.getComponents().getCallbacks().get(name); + } + return null; + } + /** * Return the first defined Schema for a RequestBody * diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java index e09d27dbb95..e024897e231 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java @@ -19,7 +19,11 @@ package org.openapitools.codegen.utils; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.media.*; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.ObjectSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.responses.ApiResponse; @@ -40,7 +44,7 @@ public class ModelUtilsTest { public void testGetAllUsedSchemas() { final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/unusedSchemas.yaml", null, new ParseOptions()).getOpenAPI(); List allUsedSchemas = ModelUtils.getAllUsedSchemas(openAPI); - Assert.assertEquals(allUsedSchemas.size(), 28); + Assert.assertEquals(allUsedSchemas.size(), 30); Assert.assertTrue(allUsedSchemas.contains("SomeObjShared"), "contains 'SomeObjShared'"); Assert.assertTrue(allUsedSchemas.contains("SomeObj1"), "contains 'UnusedObj1'"); @@ -70,6 +74,8 @@ public class ModelUtilsTest { Assert.assertTrue(allUsedSchemas.contains("Obj19ByType"), "contains 'Obj19ByType'"); Assert.assertTrue(allUsedSchemas.contains("SomeObj20"), "contains 'SomeObj20'"); Assert.assertTrue(allUsedSchemas.contains("OtherObj20"), "contains 'OtherObj20'"); + Assert.assertTrue(allUsedSchemas.contains("PingDataInput21"), "contains 'PingDataInput21'"); + Assert.assertTrue(allUsedSchemas.contains("PingDataOutput21"), "contains 'PingDataOutput21'"); } @Test diff --git a/modules/openapi-generator/src/test/resources/3_0/unusedSchemas.yaml b/modules/openapi-generator/src/test/resources/3_0/unusedSchemas.yaml index a01797944af..3df4d6e1321 100644 --- a/modules/openapi-generator/src/test/resources/3_0/unusedSchemas.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/unusedSchemas.yaml @@ -233,6 +233,36 @@ paths: text/plain: schema: $ref: '#/components/schemas/SomeObj20' + /some/p21: + post: + operationId: op21 + parameters: + - name: callbackUrl + in: query + required: true + schema: + type: string + format: uri + example: https://some-server.com + responses: + '201': + description: OK + callbacks: + onPing: + '{$request.query.callbackUrl}/ping': + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PingDataInput21' + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/PingDataOutput21' components: schemas: UnusedObj1: @@ -463,6 +493,20 @@ components: OtherObj20: type: string enum: [A, B, C] + PingDataInput21: + type: object + properties: + id: + type: integer + data: + type: String + PingDataOutput21: + type: object + properties: + id: + type: integer + reply: + type: String SomeObjShared: type: object properties: @@ -515,4 +559,5 @@ components: name: id in: query schema: - $ref: '#/components/schemas/SomeObj11' \ No newline at end of file + $ref: '#/components/schemas/SomeObj11' + \ No newline at end of file From 147e193b315c99d48f24ef0a5fc2abd9c3234669 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 18 Oct 2018 22:53:47 +0800 Subject: [PATCH 05/35] minor doc revision (#1242) --- CONTRIBUTING.md | 2 ++ docs/generators/README.md | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe33fdcb1ea..c73173c36db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,7 @@ - Search the [open issue](https://github.com/openapitools/openapi-generator/issues) to ensure no one else has reported something similar and no one is actively working on similar proposed change. - If no one has suggested something similar, open an ["issue"](https://github.com/openapitools/openapi-generator/issues) with your suggestion to gather feedback from the community. + - If you're adding a new option to a generator, please consider using the `-t` option with customized templates instead or start a discussion first by opening an issue as we want to avoid adding too many options to the generator. - It's recommended to **create a new git branch** for the change so that the merge commit message looks nicer in the commit history. ## How to contribute @@ -86,6 +87,7 @@ To test the templates, please perform the following: - Run the tests in the sample folder, e.g. in `samples/client/petstore/ruby`, run `mvn integration-test -rf :RubyPetstoreClientTests`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests) - Finally, git commit the updated samples files: `git commit -a` (`git add -A` if added files with new test cases) +- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml) To start the CI tests, you can run `mvn verify -Psamples` (assuming you've all the required tools installed to run tests for different languages) or you can leverage http://travis-ci.org to run the CI tests by adding your own openapi-generator repository. diff --git a/docs/generators/README.md b/docs/generators/README.md index 3a1869f4c37..73a2d132d65 100644 --- a/docs/generators/README.md +++ b/docs/generators/README.md @@ -12,6 +12,7 @@ The following generators are available: - [csharp](csharp.md) - [csharp-dotnet2](csharp-dotnet2.md) - [dart](dart.md) + - [dart-jaguar](dart-jaguar.md) - [eiffel](eiffel.md) - [elixir](elixir.md) - [elm](elm.md) @@ -46,6 +47,7 @@ The following generators are available: - [typescript-angular](typescript-angular.md) - [typescript-angularjs](typescript-angularjs.md) - [typescript-aurelia](typescript-aurelia.md) + - [typescript-axios](typescript-axios.md) - [typescript-fetch](typescript-fetch.md) - [typescript-inversify](typescript-inversify.md) - [typescript-jquery](typescript-jquery.md) @@ -60,8 +62,8 @@ The following generators are available: - [cpp-restbed-server](cpp-restbed-server.md) - [csharp-nancyfx](csharp-nancyfx.md) - [erlang-server](erlang-server.md) - - [go-server](go-server.md) - [go-gin-server](go-gin-server.md) + - [go-server](go-server.md) - [haskell](haskell.md) - [java-inflector](java-inflector.md) - [java-msf4j](java-msf4j.md) @@ -103,6 +105,10 @@ The following generators are available: - [openapi-yaml](openapi-yaml.md) +* SCHEMA generators: + - [mysql-schema](mysql-schema.md) + + * CONFIG generators: - [apache2](apache2.md) From 0326558f9a66044763c546fcf244402e2ea79d02 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 19 Oct 2018 00:21:40 +0800 Subject: [PATCH 06/35] update spring core version (#1265) --- .../resources/JavaSpring/libraries/spring-mvc/pom.mustache | 3 +-- samples/server/petstore/spring-mvc-j8-async/pom.xml | 3 +-- samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml | 3 +-- samples/server/petstore/spring-mvc/pom.xml | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache index 533ccb9a569..7a3ff0b2211 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache @@ -202,7 +202,6 @@ ${jackson-threetenbp-version} {{/threetenbp}} - junit junit @@ -238,6 +237,6 @@ {{#useBeanValidation}} 1.1.0.Final {{/useBeanValidation}} - 4.3.9.RELEASE + 4.3.20.RELEASE diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index 9a5afa5b5fd..8860dbb70da 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -117,7 +117,6 @@ jackson-datatype-jsr310 ${jackson-version} - junit junit @@ -149,6 +148,6 @@ 2.9.5 2.8.4 1.1.0.Final - 4.3.9.RELEASE + 4.3.20.RELEASE diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml index ea0f90c8497..007aef35494 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml @@ -117,7 +117,6 @@ jackson-datatype-jsr310 ${jackson-version} - junit junit @@ -149,6 +148,6 @@ 2.9.5 2.8.4 1.1.0.Final - 4.3.9.RELEASE + 4.3.20.RELEASE diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 6047a98e3c7..ce4506110d8 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -117,7 +117,6 @@ jackson-datatype-threetenbp ${jackson-threetenbp-version} - junit junit @@ -149,6 +148,6 @@ 2.9.5 2.8.4 1.1.0.Final - 4.3.9.RELEASE + 4.3.20.RELEASE From 27fd22482897340f66b61c78efb7fc3f1bb296db Mon Sep 17 00:00:00 2001 From: Akihito Nakano Date: Sat, 20 Oct 2018 16:06:55 +0900 Subject: [PATCH 07/35] [CLI] Fix help command (#1279) * Bump up airline * Since airline 0.8, "ParserUtil.createInstance" requires CommandFactory --- modules/openapi-generator-cli/pom.xml | 2 +- .../java/org/openapitools/codegen/cmd/CompletionCommand.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 5454f38d74e..064954b703c 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -88,7 +88,7 @@ io.airlift airline - 0.7 + 0.8 com.googlecode.lambdaj diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/CompletionCommand.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/CompletionCommand.java index 4116fe5c1d6..2ffa1208359 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/CompletionCommand.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/CompletionCommand.java @@ -84,7 +84,8 @@ public class CompletionCommand null, null, suggesterMetadata.getMetadataInjections(), - bindings.build()); + bindings.build(), + new DefaultCommandFactory()); return suggester.suggest(); } From e32b70d5794e785f4f0c4af36dc2cc7c2871da75 Mon Sep 17 00:00:00 2001 From: sunn <33183834+etherealjoy@users.noreply.github.com> Date: Sat, 20 Oct 2018 13:50:09 +0200 Subject: [PATCH 08/35] Allow all apis under a single endpoint to be hosted in one server (#1230) --- .../languages/CppPistacheServerCodegen.java | 9 +- .../cpp-pistache-server/README.mustache | 2 +- .../cpp-pistache-server/api-header.mustache | 13 +-- .../api-impl-header.mustache | 2 +- .../api-impl-source.mustache | 4 +- .../cpp-pistache-server/api-source.mustache | 25 ++---- .../cpp-pistache-server/cmake.mustache | 51 +++-------- .../main-api-server.mustache | 67 ++++++++++++-- .../petstore/cpp-pistache/CMakeLists.txt | 59 +++--------- .../cpp-pistache/PetApiMainServer.cpp | 29 ------ .../server/petstore/cpp-pistache/README.md | 2 +- .../cpp-pistache/StoreApiMainServer.cpp | 29 ------ .../cpp-pistache/UserApiMainServer.cpp | 29 ------ .../petstore/cpp-pistache/api/PetApi.cpp | 39 +++----- .../server/petstore/cpp-pistache/api/PetApi.h | 13 +-- .../petstore/cpp-pistache/api/StoreApi.cpp | 31 ++----- .../petstore/cpp-pistache/api/StoreApi.h | 11 +-- .../petstore/cpp-pistache/api/UserApi.cpp | 39 +++----- .../petstore/cpp-pistache/api/UserApi.h | 11 +-- .../petstore/cpp-pistache/impl/PetApiImpl.cpp | 4 +- .../petstore/cpp-pistache/impl/PetApiImpl.h | 2 +- .../cpp-pistache/impl/StoreApiImpl.cpp | 4 +- .../petstore/cpp-pistache/impl/StoreApiImpl.h | 2 +- .../cpp-pistache/impl/UserApiImpl.cpp | 4 +- .../petstore/cpp-pistache/impl/UserApiImpl.h | 2 +- .../petstore/cpp-pistache/main-api-server.cpp | 90 +++++++++++++++++++ 26 files changed, 242 insertions(+), 331 deletions(-) delete mode 100644 samples/server/petstore/cpp-pistache/PetApiMainServer.cpp delete mode 100644 samples/server/petstore/cpp-pistache/StoreApiMainServer.cpp delete mode 100644 samples/server/petstore/cpp-pistache/UserApiMainServer.cpp create mode 100644 samples/server/petstore/cpp-pistache/main-api-server.cpp diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java index ec069d483af..272e6966a00 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java @@ -82,8 +82,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { apiTemplateFiles.put("api-header.mustache", ".h"); apiTemplateFiles.put("api-source.mustache", ".cpp"); apiTemplateFiles.put("api-impl-header.mustache", ".h"); - apiTemplateFiles.put("api-impl-source.mustache", ".cpp"); - apiTemplateFiles.put("main-api-server.mustache", ".cpp"); + apiTemplateFiles.put("api-impl-source.mustache", ".cpp"); embeddedTemplateDir = templateDir = "cpp-pistache-server"; @@ -97,6 +96,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { supportingFiles.add(new SupportingFile("modelbase-source.mustache", "model", modelNamePrefix + "ModelBase.cpp")); supportingFiles.add(new SupportingFile("helpers-header.mustache", "model", modelNamePrefix + "Helpers.h")); supportingFiles.add(new SupportingFile("helpers-source.mustache", "model", modelNamePrefix + "Helpers.cpp")); + supportingFiles.add(new SupportingFile("main-api-server.mustache", "", modelNamePrefix + "main-api-server.cpp")); supportingFiles.add(new SupportingFile("cmake.mustache", "", "CMakeLists.txt")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); @@ -139,6 +139,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { supportingFiles.add(new SupportingFile("modelbase-source.mustache", "model", modelNamePrefix + "ModelBase.cpp")); supportingFiles.add(new SupportingFile("helpers-header.mustache", "model", modelNamePrefix + "Helpers.h")); supportingFiles.add(new SupportingFile("helpers-source.mustache", "model", modelNamePrefix + "Helpers.cpp")); + supportingFiles.add(new SupportingFile("main-api-server.mustache", "", modelNamePrefix + "main-api-server.cpp")); supportingFiles.add(new SupportingFile("cmake.mustache", "", "CMakeLists.txt")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } @@ -291,10 +292,6 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { int ix = result.lastIndexOf(File.separatorChar); result = result.substring(0, ix) + result.substring(ix, result.length() - 4) + "Impl.cpp"; result = result.replace(apiFileFolder(), implFileFolder()); - } else if (templateName.endsWith("api-server.mustache")) { - int ix = result.lastIndexOf(File.separatorChar); - result = result.substring(0, ix) + result.substring(ix, result.length() - 4) + "MainServer.cpp"; - result = result.replace(apiFileFolder(), outputFolder); } return result; } diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/README.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/README.mustache index 537ae6e826a..e6e1a0b2883 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/README.mustache @@ -35,7 +35,7 @@ Once compiled run the server: ```bash cd build -./server +./api-server ``` ## Libraries required diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache index 7ecc6c48a38..85b84385b73 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache @@ -9,12 +9,11 @@ #define {{classname}}_H_ {{{defaultInclude}}} -#include #include #include #include - #include +{{^hasModelImport}}#include "json.hpp"{{/hasModelImport}} {{#imports}}{{{import}}} {{/imports}} @@ -28,11 +27,9 @@ using namespace {{modelNamespace}};{{/hasModelImport}} class {{declspec}} {{classname}} { public: - {{classname}}(Pistache::Address addr); + {{classname}}(std::shared_ptr); virtual ~{{classname}}() {} - void init(size_t thr); - void start(); - void shutdown(); + void init(); const std::string base = "{{basePathWithoutHost}}"; @@ -44,9 +41,7 @@ private: {{/operation}} void {{classnameSnakeLowerCase}}_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - Pistache::Http::Endpoint httpEndpoint; - Pistache::Rest::Router router; - + std::shared_ptr router; {{#operation}} /// diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache index 357765cf57f..f10e9b3768d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache @@ -31,7 +31,7 @@ using namespace {{modelNamespace}};{{/hasModelImport}} class {{classname}}Impl : public {{apiNamespace}}::{{classname}} { public: - {{classname}}Impl(Pistache::Address addr); + {{classname}}Impl(std::shared_ptr); ~{{classname}}Impl() {} {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-source.mustache index d6ba91e15af..613a7dbb230 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-source.mustache @@ -10,8 +10,8 @@ namespace {{this}} { {{#hasModelImport}} using namespace {{modelNamespace}};{{/hasModelImport}} -{{classname}}Impl::{{classname}}Impl(Pistache::Address addr) - : {{classname}}(addr) +{{classname}}Impl::{{classname}}Impl(std::shared_ptr rtr) + : {{classname}}(rtr) { } {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache index 58104a36223..b8a4e34fad1 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache @@ -12,36 +12,23 @@ using namespace {{helpersNamespace}}; {{#hasModelImport}} using namespace {{modelNamespace}};{{/hasModelImport}} -{{classname}}::{{classname}}(Pistache::Address addr) - : httpEndpoint(addr) -{ }; +{{classname}}::{{classname}}(std::shared_ptr rtr) { + router = rtr; +}; -void {{classname}}::init(size_t thr = 2) { - auto opts = Pistache::Http::Endpoint::options() - .threads(thr) - .flags(Pistache::Tcp::Options::InstallSignalHandler); - httpEndpoint.init(opts); +void {{classname}}::init() { setupRoutes(); } -void {{classname}}::start() { - httpEndpoint.setHandler(router.handler()); - httpEndpoint.serve(); -} - -void {{classname}}::shutdown() { - httpEndpoint.shutdown(); -} - void {{classname}}::setupRoutes() { using namespace Pistache::Rest; {{#operation}} - Routes::{{httpMethod}}(router, base + "{{{vendorExtensions.x-codegen-pistache-path}}}", Routes::bind(&{{classname}}::{{operationIdSnakeCase}}_handler, this)); + Routes::{{httpMethod}}(*router, base + "{{{vendorExtensions.x-codegen-pistache-path}}}", Routes::bind(&{{classname}}::{{operationIdSnakeCase}}_handler, this)); {{/operation}} // Default handler, called when a route is not found - router.addCustomHandler(Routes::bind(&{{classname}}::{{classnameSnakeLowerCase}}_default_handler, this)); + router->addCustomHandler(Routes::bind(&{{classname}}::{{classnameSnakeLowerCase}}_default_handler, this)); } {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache index 11c7a5c3c52..115fac401ca 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.2) -project(server) +project(api-server) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pg -g3" ) @@ -24,48 +24,17 @@ include_directories(${EXTERNAL_INSTALL_LOCATION}/include/nlohmann) link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) {{/addExternalLibs}} -link_directories(/usr/local/lib/) - -aux_source_directory(model MODEL_SOURCES) -{{=<% %>=}} -<%#apiInfo.apis%> -<%#operations%> -file(GLOB <%classnameSnakeUpperCase%>_SOURCES -"api/<%classname%>.h" -"api/<%classname%>.cpp" -"impl/<%classname%>Impl.h" -"impl/<%classname%>Impl.cpp" -) -<%/operations%> -<%/apiInfo.apis%> - include_directories(model) include_directories(api) include_directories(impl) -<%#apiInfo.apis%> -<%#operations%> -set(<%classnameSnakeUpperCase%>_SERVER_SOURCES -<%classname%>MainServer.cpp - ${MODEL_SOURCES} - ${<%classnameSnakeUpperCase%>_SOURCES}) -<%/operations%> -<%/apiInfo.apis%> +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/model/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) -<%#apiInfo.apis%> -<%#operations%> -add_executable(<%classnameSnakeLowerCase%>_server -${<%classnameSnakeUpperCase%>_SERVER_SOURCES}) -<%#addExternalLibs%> -add_dependencies(<%classnameSnakeLowerCase%>_server PISTACHE NLOHMANN) -<%/addExternalLibs%> -<%/operations%> -<%/apiInfo.apis%> - -<%#apiInfo.apis%> -<%#operations%> -target_link_libraries(<%classnameSnakeLowerCase%>_server pistache pthread) -<%/operations%> -<%/apiInfo.apis%> - -<%={{ }}=%> \ No newline at end of file +add_executable(${PROJECT_NAME} ${SRCS} ) +add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN) +target_link_libraries(${PROJECT_NAME} pistache pthread) diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/main-api-server.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/main-api-server.mustache index 302e1c8cd66..7973d2dcb65 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/main-api-server.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/main-api-server.mustache @@ -1,21 +1,74 @@ {{>licenseInfo}} -{{#operations}} + #include "pistache/endpoint.h" #include "pistache/http.h" #include "pistache/router.h" -#include "{{classname}}Impl.h" +#ifdef __linux__ +#include +#include +#include +#endif +{{#apiInfo}}{{#apis}}{{#operations}} +#include "{{classname}}Impl.h"{{/operations}}{{/apis}}{{/apiInfo}} + +#define PISTACHE_SERVER_THREADS 2 + +static Pistache::Http::Endpoint *httpEndpoint; +#ifdef __linux__ +static void sigHandler(int sig){ + switch(sig){ + case SIGINT: + case SIGQUIT: + case SIGTERM: + case SIGHUP: + default: + httpEndpoint->shutdown(); + break; + } + exit(0); +} + +static void setUpUnixSignals(std::vector quitSignals) { + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = sigHandler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) + sigaction(sig, &sa, nullptr); +} +#endif using namespace {{apiNamespace}}; int main() { +#ifdef __linux__ + std::vector sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP}; + setUpUnixSignals(sigs); +#endif Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); - {{classname}}Impl server(addr); - server.init(2); - server.start(); + httpEndpoint = new Pistache::Http::Endpoint((addr)); + auto router = std::make_shared(); + + auto opts = Pistache::Http::Endpoint::options() + .threads(PISTACHE_SERVER_THREADS); + httpEndpoint->init(opts); + + {{#apiInfo}}{{#apis}}{{#operations}} + {{classname}}Impl {{classname}}server(router); + {{classname}}server.init();{{/operations}}{{/apis}}{{/apiInfo}} + + httpEndpoint->setHandler(router->handler()); + httpEndpoint->serve(); + + httpEndpoint->shutdown(); - server.shutdown(); } -{{/operations}} \ No newline at end of file diff --git a/samples/server/petstore/cpp-pistache/CMakeLists.txt b/samples/server/petstore/cpp-pistache/CMakeLists.txt index f355231cf2d..278caa8ab3d 100644 --- a/samples/server/petstore/cpp-pistache/CMakeLists.txt +++ b/samples/server/petstore/cpp-pistache/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.2) -project(server) +project(api-server) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pg -g3" ) @@ -22,56 +22,17 @@ include_directories(${EXTERNAL_INSTALL_LOCATION}/include) include_directories(${EXTERNAL_INSTALL_LOCATION}/include/nlohmann) link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) -link_directories(/usr/local/lib/) - -aux_source_directory(model MODEL_SOURCES) -file(GLOB PET_API_SOURCES -"api/PetApi.h" -"api/PetApi.cpp" -"impl/PetApiImpl.h" -"impl/PetApiImpl.cpp" -) -file(GLOB STORE_API_SOURCES -"api/StoreApi.h" -"api/StoreApi.cpp" -"impl/StoreApiImpl.h" -"impl/StoreApiImpl.cpp" -) -file(GLOB USER_API_SOURCES -"api/UserApi.h" -"api/UserApi.cpp" -"impl/UserApiImpl.h" -"impl/UserApiImpl.cpp" -) - include_directories(model) include_directories(api) include_directories(impl) -set(PET_API_SERVER_SOURCES -PetApiMainServer.cpp - ${MODEL_SOURCES} - ${PET_API_SOURCES}) -set(STORE_API_SERVER_SOURCES -StoreApiMainServer.cpp - ${MODEL_SOURCES} - ${STORE_API_SOURCES}) -set(USER_API_SERVER_SOURCES -UserApiMainServer.cpp - ${MODEL_SOURCES} - ${USER_API_SOURCES}) - -add_executable(pet_api_server -${PET_API_SERVER_SOURCES}) -add_dependencies(pet_api_server PISTACHE NLOHMANN) -add_executable(store_api_server -${STORE_API_SERVER_SOURCES}) -add_dependencies(store_api_server PISTACHE NLOHMANN) -add_executable(user_api_server -${USER_API_SERVER_SOURCES}) -add_dependencies(user_api_server PISTACHE NLOHMANN) - -target_link_libraries(pet_api_server pistache pthread) -target_link_libraries(store_api_server pistache pthread) -target_link_libraries(user_api_server pistache pthread) +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/model/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) +add_executable(${PROJECT_NAME} ${SRCS} ) +add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN) +target_link_libraries(${PROJECT_NAME} pistache pthread) diff --git a/samples/server/petstore/cpp-pistache/PetApiMainServer.cpp b/samples/server/petstore/cpp-pistache/PetApiMainServer.cpp deleted file mode 100644 index 0066d5f1655..00000000000 --- a/samples/server/petstore/cpp-pistache/PetApiMainServer.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - -#include "pistache/endpoint.h" -#include "pistache/http.h" -#include "pistache/router.h" -#include "PetApiImpl.h" - -using namespace org::openapitools::server::api; - -int main() { - Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); - - PetApiImpl server(addr); - server.init(2); - server.start(); - - server.shutdown(); -} - diff --git a/samples/server/petstore/cpp-pistache/README.md b/samples/server/petstore/cpp-pistache/README.md index f7245d2cf24..c8587ab3d70 100644 --- a/samples/server/petstore/cpp-pistache/README.md +++ b/samples/server/petstore/cpp-pistache/README.md @@ -35,7 +35,7 @@ Once compiled run the server: ```bash cd build -./server +./api-server ``` ## Libraries required diff --git a/samples/server/petstore/cpp-pistache/StoreApiMainServer.cpp b/samples/server/petstore/cpp-pistache/StoreApiMainServer.cpp deleted file mode 100644 index b63fdbd8d89..00000000000 --- a/samples/server/petstore/cpp-pistache/StoreApiMainServer.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - -#include "pistache/endpoint.h" -#include "pistache/http.h" -#include "pistache/router.h" -#include "StoreApiImpl.h" - -using namespace org::openapitools::server::api; - -int main() { - Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); - - StoreApiImpl server(addr); - server.init(2); - server.start(); - - server.shutdown(); -} - diff --git a/samples/server/petstore/cpp-pistache/UserApiMainServer.cpp b/samples/server/petstore/cpp-pistache/UserApiMainServer.cpp deleted file mode 100644 index 5108b0d4cd1..00000000000 --- a/samples/server/petstore/cpp-pistache/UserApiMainServer.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - -#include "pistache/endpoint.h" -#include "pistache/http.h" -#include "pistache/router.h" -#include "UserApiImpl.h" - -using namespace org::openapitools::server::api; - -int main() { - Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); - - UserApiImpl server(addr); - server.init(2); - server.start(); - - server.shutdown(); -} - diff --git a/samples/server/petstore/cpp-pistache/api/PetApi.cpp b/samples/server/petstore/cpp-pistache/api/PetApi.cpp index df764048389..c62755f78de 100644 --- a/samples/server/petstore/cpp-pistache/api/PetApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/PetApi.cpp @@ -21,41 +21,28 @@ namespace api { using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; -PetApi::PetApi(Pistache::Address addr) - : httpEndpoint(addr) -{ }; +PetApi::PetApi(std::shared_ptr rtr) { + router = rtr; +}; -void PetApi::init(size_t thr = 2) { - auto opts = Pistache::Http::Endpoint::options() - .threads(thr) - .flags(Pistache::Tcp::Options::InstallSignalHandler); - httpEndpoint.init(opts); +void PetApi::init() { setupRoutes(); } -void PetApi::start() { - httpEndpoint.setHandler(router.handler()); - httpEndpoint.serve(); -} - -void PetApi::shutdown() { - httpEndpoint.shutdown(); -} - void PetApi::setupRoutes() { using namespace Pistache::Rest; - Routes::Post(router, base + "/pet", Routes::bind(&PetApi::add_pet_handler, this)); - Routes::Delete(router, base + "/pet/:petId", Routes::bind(&PetApi::delete_pet_handler, this)); - Routes::Get(router, base + "/pet/findByStatus", Routes::bind(&PetApi::find_pets_by_status_handler, this)); - Routes::Get(router, base + "/pet/findByTags", Routes::bind(&PetApi::find_pets_by_tags_handler, this)); - Routes::Get(router, base + "/pet/:petId", Routes::bind(&PetApi::get_pet_by_id_handler, this)); - Routes::Put(router, base + "/pet", Routes::bind(&PetApi::update_pet_handler, this)); - Routes::Post(router, base + "/pet/:petId", Routes::bind(&PetApi::update_pet_with_form_handler, this)); - Routes::Post(router, base + "/pet/:petId/uploadImage", Routes::bind(&PetApi::upload_file_handler, this)); + Routes::Post(*router, base + "/pet", Routes::bind(&PetApi::add_pet_handler, this)); + Routes::Delete(*router, base + "/pet/:petId", Routes::bind(&PetApi::delete_pet_handler, this)); + Routes::Get(*router, base + "/pet/findByStatus", Routes::bind(&PetApi::find_pets_by_status_handler, this)); + Routes::Get(*router, base + "/pet/findByTags", Routes::bind(&PetApi::find_pets_by_tags_handler, this)); + Routes::Get(*router, base + "/pet/:petId", Routes::bind(&PetApi::get_pet_by_id_handler, this)); + Routes::Put(*router, base + "/pet", Routes::bind(&PetApi::update_pet_handler, this)); + Routes::Post(*router, base + "/pet/:petId", Routes::bind(&PetApi::update_pet_with_form_handler, this)); + Routes::Post(*router, base + "/pet/:petId/uploadImage", Routes::bind(&PetApi::upload_file_handler, this)); // Default handler, called when a route is not found - router.addCustomHandler(Routes::bind(&PetApi::pet_api_default_handler, this)); + router->addCustomHandler(Routes::bind(&PetApi::pet_api_default_handler, this)); } void PetApi::add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { diff --git a/samples/server/petstore/cpp-pistache/api/PetApi.h b/samples/server/petstore/cpp-pistache/api/PetApi.h index db76fa2654e..5f4e983458e 100644 --- a/samples/server/petstore/cpp-pistache/api/PetApi.h +++ b/samples/server/petstore/cpp-pistache/api/PetApi.h @@ -19,7 +19,6 @@ #define PetApi_H_ -#include #include #include #include @@ -39,11 +38,9 @@ using namespace org::openapitools::server::model; class PetApi { public: - PetApi(Pistache::Address addr); + PetApi(std::shared_ptr); virtual ~PetApi() {} - void init(size_t thr); - void start(); - void shutdown(); + void init(); const std::string base = "/v2"; @@ -60,9 +57,7 @@ private: void upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void pet_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - Pistache::Http::Endpoint httpEndpoint; - Pistache::Rest::Router router; - + std::shared_ptr router; /// /// Add a new pet to the store @@ -80,7 +75,7 @@ private: /// /// /// Pet id to delete - /// (optional) + /// (optional, default to "") virtual void delete_pet(const int64_t &petId, const Pistache::Optional &apiKey, Pistache::Http::ResponseWriter &response) = 0; /// diff --git a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp index 8097ca8f2f1..58b9b28986d 100644 --- a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp @@ -21,37 +21,24 @@ namespace api { using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; -StoreApi::StoreApi(Pistache::Address addr) - : httpEndpoint(addr) -{ }; +StoreApi::StoreApi(std::shared_ptr rtr) { + router = rtr; +}; -void StoreApi::init(size_t thr = 2) { - auto opts = Pistache::Http::Endpoint::options() - .threads(thr) - .flags(Pistache::Tcp::Options::InstallSignalHandler); - httpEndpoint.init(opts); +void StoreApi::init() { setupRoutes(); } -void StoreApi::start() { - httpEndpoint.setHandler(router.handler()); - httpEndpoint.serve(); -} - -void StoreApi::shutdown() { - httpEndpoint.shutdown(); -} - void StoreApi::setupRoutes() { using namespace Pistache::Rest; - Routes::Delete(router, base + "/store/order/:orderId", Routes::bind(&StoreApi::delete_order_handler, this)); - Routes::Get(router, base + "/store/inventory", Routes::bind(&StoreApi::get_inventory_handler, this)); - Routes::Get(router, base + "/store/order/:orderId", Routes::bind(&StoreApi::get_order_by_id_handler, this)); - Routes::Post(router, base + "/store/order", Routes::bind(&StoreApi::place_order_handler, this)); + Routes::Delete(*router, base + "/store/order/:orderId", Routes::bind(&StoreApi::delete_order_handler, this)); + Routes::Get(*router, base + "/store/inventory", Routes::bind(&StoreApi::get_inventory_handler, this)); + Routes::Get(*router, base + "/store/order/:orderId", Routes::bind(&StoreApi::get_order_by_id_handler, this)); + Routes::Post(*router, base + "/store/order", Routes::bind(&StoreApi::place_order_handler, this)); // Default handler, called when a route is not found - router.addCustomHandler(Routes::bind(&StoreApi::store_api_default_handler, this)); + router->addCustomHandler(Routes::bind(&StoreApi::store_api_default_handler, this)); } void StoreApi::delete_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { diff --git a/samples/server/petstore/cpp-pistache/api/StoreApi.h b/samples/server/petstore/cpp-pistache/api/StoreApi.h index b5625112db5..e75f9374d08 100644 --- a/samples/server/petstore/cpp-pistache/api/StoreApi.h +++ b/samples/server/petstore/cpp-pistache/api/StoreApi.h @@ -19,7 +19,6 @@ #define StoreApi_H_ -#include #include #include #include @@ -39,11 +38,9 @@ using namespace org::openapitools::server::model; class StoreApi { public: - StoreApi(Pistache::Address addr); + StoreApi(std::shared_ptr); virtual ~StoreApi() {} - void init(size_t thr); - void start(); - void shutdown(); + void init(); const std::string base = "/v2"; @@ -56,9 +53,7 @@ private: void place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - Pistache::Http::Endpoint httpEndpoint; - Pistache::Rest::Router router; - + std::shared_ptr router; /// /// Delete purchase order by ID diff --git a/samples/server/petstore/cpp-pistache/api/UserApi.cpp b/samples/server/petstore/cpp-pistache/api/UserApi.cpp index 13b70d9215a..62dc29967ee 100644 --- a/samples/server/petstore/cpp-pistache/api/UserApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/UserApi.cpp @@ -21,41 +21,28 @@ namespace api { using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; -UserApi::UserApi(Pistache::Address addr) - : httpEndpoint(addr) -{ }; +UserApi::UserApi(std::shared_ptr rtr) { + router = rtr; +}; -void UserApi::init(size_t thr = 2) { - auto opts = Pistache::Http::Endpoint::options() - .threads(thr) - .flags(Pistache::Tcp::Options::InstallSignalHandler); - httpEndpoint.init(opts); +void UserApi::init() { setupRoutes(); } -void UserApi::start() { - httpEndpoint.setHandler(router.handler()); - httpEndpoint.serve(); -} - -void UserApi::shutdown() { - httpEndpoint.shutdown(); -} - void UserApi::setupRoutes() { using namespace Pistache::Rest; - Routes::Post(router, base + "/user", Routes::bind(&UserApi::create_user_handler, this)); - Routes::Post(router, base + "/user/createWithArray", Routes::bind(&UserApi::create_users_with_array_input_handler, this)); - Routes::Post(router, base + "/user/createWithList", Routes::bind(&UserApi::create_users_with_list_input_handler, this)); - Routes::Delete(router, base + "/user/:username", Routes::bind(&UserApi::delete_user_handler, this)); - Routes::Get(router, base + "/user/:username", Routes::bind(&UserApi::get_user_by_name_handler, this)); - Routes::Get(router, base + "/user/login", Routes::bind(&UserApi::login_user_handler, this)); - Routes::Get(router, base + "/user/logout", Routes::bind(&UserApi::logout_user_handler, this)); - Routes::Put(router, base + "/user/:username", Routes::bind(&UserApi::update_user_handler, this)); + Routes::Post(*router, base + "/user", Routes::bind(&UserApi::create_user_handler, this)); + Routes::Post(*router, base + "/user/createWithArray", Routes::bind(&UserApi::create_users_with_array_input_handler, this)); + Routes::Post(*router, base + "/user/createWithList", Routes::bind(&UserApi::create_users_with_list_input_handler, this)); + Routes::Delete(*router, base + "/user/:username", Routes::bind(&UserApi::delete_user_handler, this)); + Routes::Get(*router, base + "/user/:username", Routes::bind(&UserApi::get_user_by_name_handler, this)); + Routes::Get(*router, base + "/user/login", Routes::bind(&UserApi::login_user_handler, this)); + Routes::Get(*router, base + "/user/logout", Routes::bind(&UserApi::logout_user_handler, this)); + Routes::Put(*router, base + "/user/:username", Routes::bind(&UserApi::update_user_handler, this)); // Default handler, called when a route is not found - router.addCustomHandler(Routes::bind(&UserApi::user_api_default_handler, this)); + router->addCustomHandler(Routes::bind(&UserApi::user_api_default_handler, this)); } void UserApi::create_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { diff --git a/samples/server/petstore/cpp-pistache/api/UserApi.h b/samples/server/petstore/cpp-pistache/api/UserApi.h index aebd1a97ac7..cd81b195ed0 100644 --- a/samples/server/petstore/cpp-pistache/api/UserApi.h +++ b/samples/server/petstore/cpp-pistache/api/UserApi.h @@ -19,7 +19,6 @@ #define UserApi_H_ -#include #include #include #include @@ -39,11 +38,9 @@ using namespace org::openapitools::server::model; class UserApi { public: - UserApi(Pistache::Address addr); + UserApi(std::shared_ptr); virtual ~UserApi() {} - void init(size_t thr); - void start(); - void shutdown(); + void init(); const std::string base = "/v2"; @@ -60,9 +57,7 @@ private: void update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void user_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - Pistache::Http::Endpoint httpEndpoint; - Pistache::Rest::Router router; - + std::shared_ptr router; /// /// Create user diff --git a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp index 111441543c1..6e8801d1a30 100644 --- a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp +++ b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp @@ -19,8 +19,8 @@ namespace api { using namespace org::openapitools::server::model; -PetApiImpl::PetApiImpl(Pistache::Address addr) - : PetApi(addr) +PetApiImpl::PetApiImpl(std::shared_ptr rtr) + : PetApi(rtr) { } void PetApiImpl::add_pet(const Pet &pet, Pistache::Http::ResponseWriter &response) { diff --git a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h index 63f72a254ae..3cca98421fd 100644 --- a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h @@ -42,7 +42,7 @@ using namespace org::openapitools::server::model; class PetApiImpl : public org::openapitools::server::api::PetApi { public: - PetApiImpl(Pistache::Address addr); + PetApiImpl(std::shared_ptr); ~PetApiImpl() {} void add_pet(const Pet &pet, Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.cpp b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.cpp index ffe74b62f2e..f5367c72b7f 100644 --- a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.cpp +++ b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.cpp @@ -19,8 +19,8 @@ namespace api { using namespace org::openapitools::server::model; -StoreApiImpl::StoreApiImpl(Pistache::Address addr) - : StoreApi(addr) +StoreApiImpl::StoreApiImpl(std::shared_ptr rtr) + : StoreApi(rtr) { } void StoreApiImpl::delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) { diff --git a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h index 8109a2c1392..d28acea1f67 100644 --- a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h @@ -42,7 +42,7 @@ using namespace org::openapitools::server::model; class StoreApiImpl : public org::openapitools::server::api::StoreApi { public: - StoreApiImpl(Pistache::Address addr); + StoreApiImpl(std::shared_ptr); ~StoreApiImpl() {} void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.cpp b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.cpp index 4dc0d57e407..a810c266fdf 100644 --- a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.cpp +++ b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.cpp @@ -19,8 +19,8 @@ namespace api { using namespace org::openapitools::server::model; -UserApiImpl::UserApiImpl(Pistache::Address addr) - : UserApi(addr) +UserApiImpl::UserApiImpl(std::shared_ptr rtr) + : UserApi(rtr) { } void UserApiImpl::create_user(const User &user, Pistache::Http::ResponseWriter &response) { diff --git a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h index 98cb593e694..771f3eaeef2 100644 --- a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h @@ -42,7 +42,7 @@ using namespace org::openapitools::server::model; class UserApiImpl : public org::openapitools::server::api::UserApi { public: - UserApiImpl(Pistache::Address addr); + UserApiImpl(std::shared_ptr); ~UserApiImpl() {} void create_user(const User &user, Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/main-api-server.cpp b/samples/server/petstore/cpp-pistache/main-api-server.cpp new file mode 100644 index 00000000000..942f9c149fe --- /dev/null +++ b/samples/server/petstore/cpp-pistache/main-api-server.cpp @@ -0,0 +1,90 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* OpenAPI spec version: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "pistache/endpoint.h" +#include "pistache/http.h" +#include "pistache/router.h" +#ifdef __linux__ +#include +#include +#include +#endif + +#include "PetApiImpl.h" +#include "StoreApiImpl.h" +#include "UserApiImpl.h" + +#define PISTACHE_SERVER_THREADS 2 + +static Pistache::Http::Endpoint *httpEndpoint; +#ifdef __linux__ +static void sigHandler(int sig){ + switch(sig){ + case SIGINT: + case SIGQUIT: + case SIGTERM: + case SIGHUP: + default: + httpEndpoint->shutdown(); + break; + } + exit(0); +} + +static void setUpUnixSignals(std::vector quitSignals) { + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = sigHandler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) + sigaction(sig, &sa, nullptr); +} +#endif + +using namespace org::openapitools::server::api; + +int main() { +#ifdef __linux__ + std::vector sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP}; + setUpUnixSignals(sigs); +#endif + Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); + + httpEndpoint = new Pistache::Http::Endpoint((addr)); + auto router = std::make_shared(); + + auto opts = Pistache::Http::Endpoint::options() + .threads(PISTACHE_SERVER_THREADS); + httpEndpoint->init(opts); + + + PetApiImpl PetApiserver(router); + PetApiserver.init(); + StoreApiImpl StoreApiserver(router); + StoreApiserver.init(); + UserApiImpl UserApiserver(router); + UserApiserver.init(); + + httpEndpoint->setHandler(router->handler()); + httpEndpoint->serve(); + + httpEndpoint->shutdown(); + +} + From 0853b2d31ddf91541ee2b282f6544a9d6d25f1a8 Mon Sep 17 00:00:00 2001 From: sunn <33183834+etherealjoy@users.noreply.github.com> Date: Sat, 20 Oct 2018 13:52:46 +0200 Subject: [PATCH 09/35] Add ref support inside fromProperty (#1235) --- .../languages/CppRestSdkClientCodegen.java | 22 ++++++++++++++++++- .../cpp-rest-sdk-client/api-header.mustache | 1 + .../client/petstore/cpp-restsdk/api/PetApi.h | 1 + .../petstore/cpp-restsdk/api/StoreApi.h | 1 + .../client/petstore/cpp-restsdk/api/UserApi.h | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index 841e1c2dd09..5a8424838ba 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -38,6 +38,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -154,7 +155,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { typeMapping.put("map", "std::map"); typeMapping.put("file", "HttpContent"); typeMapping.put("object", "Object"); - typeMapping.put("binary", "std::string"); + typeMapping.put("binary", "utility::string_t"); typeMapping.put("number", "double"); typeMapping.put("UUID", "utility::string_t"); typeMapping.put("ByteArray", "utility::string_t"); @@ -249,6 +250,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { if (methodResponse != null) { Schema response = ModelUtils.getSchemaFromResponse(methodResponse); + response = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), response); if (response != null) { CodegenProperty cm = fromProperty("response", response); op.vendorExtensions.put("x-codegen-response", cm); @@ -276,6 +278,24 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { } } + // override with any special post-processing + @SuppressWarnings("unchecked") + @Override + public Map postProcessOperationsWithModels(Map objs, List allModels) { + Map operations = (Map) objs.get("operations"); + List operationList = (List) operations.get("operation"); + for (CodegenOperation op : operationList) { + for(String hdr : op.imports) { + if(importMapping.containsKey(hdr)) { + continue; + } + operations.put("hasModelImport", true); + break; + } + } + return objs; + } + protected boolean isFileSchema(CodegenProperty property) { return property.baseType.equals("HttpContent"); } diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index fbf515deb15..1df116498b2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -13,6 +13,7 @@ {{#imports}}{{{import}}} {{/imports}} +{{^hasModelImport}}#include "../ModelBase.h"{{/hasModelImport}} #include diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/api/PetApi.h index 0313da30395..a4b37987816 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.h @@ -26,6 +26,7 @@ #include "Pet.h" #include + #include namespace org { diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h index 507756dee1d..3a2a1ac3b32 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.h @@ -25,6 +25,7 @@ #include #include + #include namespace org { diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h index ea184c0cf76..c0ea7d3b1f2 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.h @@ -25,6 +25,7 @@ #include #include + #include namespace org { From f1d4ae230e7e833659295a43c8f0ea20d8d03675 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 21 Oct 2018 21:39:26 +0800 Subject: [PATCH 10/35] Remove outdated comment (#1268) --- .../src/main/resources/lua/api.mustache | 2 -- samples/client/petstore/lua/.openapi-generator/VERSION | 2 +- samples/client/petstore/lua/petstore/api/pet_api.lua | 9 +-------- samples/client/petstore/lua/petstore/api/store_api.lua | 4 +--- samples/client/petstore/lua/petstore/api/user_api.lua | 3 +-- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/lua/api.mustache b/modules/openapi-generator/src/main/resources/lua/api.mustache index d8408da2553..af75e87606e 100644 --- a/modules/openapi-generator/src/main/resources/lua/api.mustache +++ b/modules/openapi-generator/src/main/resources/lua/api.mustache @@ -49,14 +49,12 @@ function {{classname}}:{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, req.headers:upsert(":method", "{{httpMethod}}") {{#hasConsumes}} -- TODO: create a function to select proper accept - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_content_type = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} } req.headers:upsert("accept", {{#consumes}}{{#-first}}"{{{mediaType}}}"{{/-first}}{{/consumes}}) {{/hasConsumes}} {{#hasProduces}} -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} } req.headers:upsert("content-type", {{#produces}}{{#-first}}"{{{mediaType}}}"{{/-first}}{{/produces}}) diff --git a/samples/client/petstore/lua/.openapi-generator/VERSION b/samples/client/petstore/lua/.openapi-generator/VERSION index 096bf47efe3..a6527129083 100644 --- a/samples/client/petstore/lua/.openapi-generator/VERSION +++ b/samples/client/petstore/lua/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/lua/petstore/api/pet_api.lua b/samples/client/petstore/lua/petstore/api/pet_api.lua index 56a67b91bff..9e27ac3bdb1 100644 --- a/samples/client/petstore/lua/petstore/api/pet_api.lua +++ b/samples/client/petstore/lua/petstore/api/pet_api.lua @@ -18,6 +18,7 @@ local basexx = require "basexx" -- model import local petstore_api_response = require "petstore.model.api_response" local petstore_pet = require "petstore.model.pet" +local petstore_pet = require "petstore.model.pet" local pet_api = {} local pet_api_mt = { @@ -54,7 +55,6 @@ function pet_api:add_pet(pet) -- set HTTP verb req.headers:upsert(":method", "POST") -- TODO: create a function to select proper accept - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_content_type = { "application/json", "application/xml" } req.headers:upsert("accept", "application/json") @@ -132,7 +132,6 @@ function pet_api:find_pets_by_status(status) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") @@ -185,7 +184,6 @@ function pet_api:find_pets_by_tags(tags) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") @@ -238,7 +236,6 @@ function pet_api:get_pet_by_id(pet_id) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") @@ -288,7 +285,6 @@ function pet_api:update_pet(pet) -- set HTTP verb req.headers:upsert(":method", "PUT") -- TODO: create a function to select proper accept - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_content_type = { "application/json", "application/xml" } req.headers:upsert("accept", "application/json") @@ -329,7 +325,6 @@ function pet_api:update_pet_with_form(pet_id, name, status) -- set HTTP verb req.headers:upsert(":method", "POST") -- TODO: create a function to select proper accept - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_content_type = { "application/x-www-form-urlencoded" } req.headers:upsert("accept", "application/x-www-form-urlencoded") @@ -372,12 +367,10 @@ function pet_api:upload_file(pet_id, additional_metadata, file) -- set HTTP verb req.headers:upsert(":method", "POST") -- TODO: create a function to select proper accept - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_content_type = { "multipart/form-data" } req.headers:upsert("accept", "multipart/form-data") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/json" } req.headers:upsert("content-type", "application/json") diff --git a/samples/client/petstore/lua/petstore/api/store_api.lua b/samples/client/petstore/lua/petstore/api/store_api.lua index 75e3023c3b9..0ef6ae56bc7 100644 --- a/samples/client/petstore/lua/petstore/api/store_api.lua +++ b/samples/client/petstore/lua/petstore/api/store_api.lua @@ -17,6 +17,7 @@ local basexx = require "basexx" -- model import local petstore_order = require "petstore.model.order" +local petstore_order = require "petstore.model.order" local store_api = {} local store_api_mt = { @@ -83,7 +84,6 @@ function store_api:get_inventory() -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/json" } req.headers:upsert("content-type", "application/json") @@ -133,7 +133,6 @@ function store_api:get_order_by_id(order_id) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") @@ -179,7 +178,6 @@ function store_api:place_order(order) -- set HTTP verb req.headers:upsert(":method", "POST") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") diff --git a/samples/client/petstore/lua/petstore/api/user_api.lua b/samples/client/petstore/lua/petstore/api/user_api.lua index 0e47c3bdcc0..1febe3aee48 100644 --- a/samples/client/petstore/lua/petstore/api/user_api.lua +++ b/samples/client/petstore/lua/petstore/api/user_api.lua @@ -17,6 +17,7 @@ local basexx = require "basexx" -- model import local petstore_user = require "petstore.model.user" +local petstore_user = require "petstore.model.user" local user_api = {} local user_api_mt = { @@ -179,7 +180,6 @@ function user_api:get_user_by_name(username) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") @@ -225,7 +225,6 @@ function user_api:login_user(username, password) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type - -- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879 --local var_accept = { "application/xml", "application/json" } req.headers:upsert("content-type", "application/xml") From 33a1ac439734a2af2e3d7813b040322bc62fa651 Mon Sep 17 00:00:00 2001 From: moreginger Date: Sun, 21 Oct 2018 15:01:47 +0100 Subject: [PATCH 11/35] Don't generate unused ApiException class for java/webclient. (#1165) --- .../codegen/languages/JavaClientCodegen.java | 5 +- .../Java/libraries/webclient/api.mustache | 3 +- .../libraries/webclient/api_test.mustache | 6 +- .../org/openapitools/client/ApiException.java | 91 ------------------- .../openapitools/client/Configuration.java | 39 -------- .../java/org/openapitools/client/Pair.java | 61 ------------- .../client/api/AnotherFakeApi.java | 1 - .../org/openapitools/client/api/FakeApi.java | 1 - .../client/api/FakeClassnameTags123Api.java | 1 - .../org/openapitools/client/api/PetApi.java | 1 - .../org/openapitools/client/api/StoreApi.java | 1 - .../org/openapitools/client/api/UserApi.java | 1 - .../client/api/AnotherFakeApiTest.java | 6 +- .../openapitools/client/api/FakeApiTest.java | 67 +++++--------- .../api/FakeClassnameTags123ApiTest.java | 6 +- .../openapitools/client/api/PetApiTest.java | 50 +++------- .../openapitools/client/api/StoreApiTest.java | 21 +---- .../openapitools/client/api/UserApiTest.java | 41 ++------- 18 files changed, 56 insertions(+), 346 deletions(-) delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 8bbaec641c7..39969fdfbfb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -269,10 +269,13 @@ public class JavaClientCodegen extends AbstractJavaCodegen apiDocTemplateFiles.remove("api_doc.mustache"); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); + } + + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 9c3f9fb140c..c29a160fc4f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -5,8 +5,7 @@ import {{invokerPackage}}.ApiClient; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}}import java.util.ArrayList; -import java.util.HashMap; +{{^fullJavaUtil}}import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map;{{/fullJavaUtil}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache index f1dca2f41cf..1b730bf43a7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache @@ -2,7 +2,6 @@ package {{package}}; -import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} import org.junit.Test; @@ -28,12 +27,9 @@ public class {{classname}}Test { * {{summary}} * * {{notes}} - * - * @throws ApiException - * if the Api call fails */ @Test - public void {{operationId}}Test() throws ApiException { + public void {{operationId}}Test() { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java deleted file mode 100644 index 6f360360783..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - -import java.util.Map; -import java.util.List; - - -public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java deleted file mode 100644 index 1545483fe0b..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - - -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java deleted file mode 100644 index 0619e8c408b..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - - -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 845a1e5cde9..fd44d8122f8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index a6edb74655d..bd18f677378 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -11,7 +11,6 @@ import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.User; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 15f1d2e6791..31e95c77ccb 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index febe863feda..a746058c7f7 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -6,7 +6,6 @@ import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java index 383bc7ace0f..c4747ea723a 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Order; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java index 4b38490e704..89bcf01c8ae 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.User; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index 6f593f9144d..e0487304635 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class AnotherFakeApiTest { * To test special tags * * To test special tags and operation ID starting with number - * - * @throws ApiException - * if the Api call fails */ @Test - public void call123testSpecialTagsTest() throws ApiException { + public void call123testSpecialTagsTest() { Client client = null; Client response = api.call123testSpecialTags(client).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java index be858a81953..9c1ca7fdc04 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -13,10 +13,10 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import java.math.BigDecimal; import org.openapitools.client.model.Client; import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; import java.time.LocalDate; import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; @@ -42,12 +42,9 @@ public class FakeApiTest { * * * Test serialization of outer boolean types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterBooleanSerializeTest() throws ApiException { + public void fakeOuterBooleanSerializeTest() { Boolean body = null; Boolean response = api.fakeOuterBooleanSerialize(body).block(); @@ -58,12 +55,9 @@ public class FakeApiTest { * * * Test serialization of object with outer number type - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterCompositeSerializeTest() throws ApiException { + public void fakeOuterCompositeSerializeTest() { OuterComposite outerComposite = null; OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite).block(); @@ -74,12 +68,9 @@ public class FakeApiTest { * * * Test serialization of outer number types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterNumberSerializeTest() throws ApiException { + public void fakeOuterNumberSerializeTest() { BigDecimal body = null; BigDecimal response = api.fakeOuterNumberSerialize(body).block(); @@ -90,12 +81,9 @@ public class FakeApiTest { * * * Test serialization of outer string types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterStringSerializeTest() throws ApiException { + public void fakeOuterStringSerializeTest() { String body = null; String response = api.fakeOuterStringSerialize(body).block(); @@ -105,13 +93,23 @@ public class FakeApiTest { /** * * - * - * - * @throws ApiException - * if the Api call fails + * For this test, the body for this request much reference a schema named `File`. */ @Test - public void testBodyWithQueryParamsTest() throws ApiException { + public void testBodyWithFileSchemaTest() { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass).block(); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void testBodyWithQueryParamsTest() { String query = null; User user = null; api.testBodyWithQueryParams(query, user).block(); @@ -123,12 +121,9 @@ public class FakeApiTest { * To test \"client\" model * * To test \"client\" model - * - * @throws ApiException - * if the Api call fails */ @Test - public void testClientModelTest() throws ApiException { + public void testClientModelTest() { Client client = null; Client response = api.testClientModel(client).block(); @@ -139,12 +134,9 @@ public class FakeApiTest { * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * - * @throws ApiException - * if the Api call fails */ @Test - public void testEndpointParametersTest() throws ApiException { + public void testEndpointParametersTest() { BigDecimal number = null; Double _double = null; String patternWithoutDelimiter = null; @@ -168,12 +160,9 @@ public class FakeApiTest { * To test enum parameters * * To test enum parameters - * - * @throws ApiException - * if the Api call fails */ @Test - public void testEnumParametersTest() throws ApiException { + public void testEnumParametersTest() { List enumHeaderStringArray = null; String enumHeaderString = null; List enumQueryStringArray = null; @@ -191,12 +180,9 @@ public class FakeApiTest { * test inline additionalProperties * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void testInlineAdditionalPropertiesTest() throws ApiException { + public void testInlineAdditionalPropertiesTest() { Map requestBody = null; api.testInlineAdditionalProperties(requestBody).block(); @@ -207,12 +193,9 @@ public class FakeApiTest { * test json serialization of form data * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void testJsonFormDataTest() throws ApiException { + public void testJsonFormDataTest() { String param = null; String param2 = null; api.testJsonFormData(param, param2).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index dfa7edd396a..ffa015e8f5f 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class FakeClassnameTags123ApiTest { * To test class name in snake case * * To test class name in snake case - * - * @throws ApiException - * if the Api call fails */ @Test - public void testClassnameTest() throws ApiException { + public void testClassnameTest() { Client client = null; Client response = api.testClassname(client).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java index a03056a49df..463aec5a426 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; @@ -38,12 +37,9 @@ public class PetApiTest { * Add a new pet to the store * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void addPetTest() throws ApiException { + public void addPetTest() { Pet pet = null; api.addPet(pet).block(); @@ -54,12 +50,9 @@ public class PetApiTest { * Deletes a pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void deletePetTest() throws ApiException { + public void deletePetTest() { Long petId = null; String apiKey = null; api.deletePet(petId, apiKey).block(); @@ -71,12 +64,9 @@ public class PetApiTest { * Finds Pets by status * * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails */ @Test - public void findPetsByStatusTest() throws ApiException { + public void findPetsByStatusTest() { List status = null; List response = api.findPetsByStatus(status).collectList().block(); @@ -87,12 +77,9 @@ public class PetApiTest { * Finds Pets by tags * * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails */ @Test - public void findPetsByTagsTest() throws ApiException { + public void findPetsByTagsTest() { List tags = null; List response = api.findPetsByTags(tags).collectList().block(); @@ -103,12 +90,9 @@ public class PetApiTest { * Find pet by ID * * Returns a single pet - * - * @throws ApiException - * if the Api call fails */ @Test - public void getPetByIdTest() throws ApiException { + public void getPetByIdTest() { Long petId = null; Pet response = api.getPetById(petId).block(); @@ -119,12 +103,9 @@ public class PetApiTest { * Update an existing pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void updatePetTest() throws ApiException { + public void updatePetTest() { Pet pet = null; api.updatePet(pet).block(); @@ -135,12 +116,9 @@ public class PetApiTest { * Updates a pet in the store with form data * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void updatePetWithFormTest() throws ApiException { + public void updatePetWithFormTest() { Long petId = null; String name = null; String status = null; @@ -153,12 +131,9 @@ public class PetApiTest { * uploads an image * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void uploadFileTest() throws ApiException { + public void uploadFileTest() { Long petId = null; String additionalMetadata = null; File file = null; @@ -171,16 +146,13 @@ public class PetApiTest { * uploads an image (required) * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void uploadFileWithRequiredFileTest() throws ApiException { + public void uploadFileWithRequiredFileTest() { Long petId = null; - File file = null; + File requiredFile = null; String additionalMetadata = null; - ModelApiResponse response = api.uploadFileWithRequiredFile(petId, file, additionalMetadata).block(); + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata).block(); // TODO: test validations } diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java index 477e4c1af00..09fb1c5a1b2 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Order; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class StoreApiTest { * Delete purchase order by ID * * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails */ @Test - public void deleteOrderTest() throws ApiException { + public void deleteOrderTest() { String orderId = null; api.deleteOrder(orderId).block(); @@ -52,12 +48,9 @@ public class StoreApiTest { * Returns pet inventories by status * * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails */ @Test - public void getInventoryTest() throws ApiException { + public void getInventoryTest() { Map response = api.getInventory().block(); // TODO: test validations @@ -67,12 +60,9 @@ public class StoreApiTest { * Find purchase order by ID * * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails */ @Test - public void getOrderByIdTest() throws ApiException { + public void getOrderByIdTest() { Long orderId = null; Order response = api.getOrderById(orderId).block(); @@ -83,12 +73,9 @@ public class StoreApiTest { * Place an order for a pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void placeOrderTest() throws ApiException { + public void placeOrderTest() { Order order = null; Order response = api.placeOrder(order).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java index ce86e5d94ba..146f6b08bce 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.User; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class UserApiTest { * Create user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUserTest() throws ApiException { + public void createUserTest() { User user = null; api.createUser(user).block(); @@ -52,12 +48,9 @@ public class UserApiTest { * Creates list of users with given input array * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUsersWithArrayInputTest() throws ApiException { + public void createUsersWithArrayInputTest() { List user = null; api.createUsersWithArrayInput(user).block(); @@ -68,12 +61,9 @@ public class UserApiTest { * Creates list of users with given input array * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUsersWithListInputTest() throws ApiException { + public void createUsersWithListInputTest() { List user = null; api.createUsersWithListInput(user).block(); @@ -84,12 +74,9 @@ public class UserApiTest { * Delete user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void deleteUserTest() throws ApiException { + public void deleteUserTest() { String username = null; api.deleteUser(username).block(); @@ -100,12 +87,9 @@ public class UserApiTest { * Get user by user name * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void getUserByNameTest() throws ApiException { + public void getUserByNameTest() { String username = null; User response = api.getUserByName(username).block(); @@ -116,12 +100,9 @@ public class UserApiTest { * Logs user into the system * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void loginUserTest() throws ApiException { + public void loginUserTest() { String username = null; String password = null; String response = api.loginUser(username, password).block(); @@ -133,12 +114,9 @@ public class UserApiTest { * Logs out current logged in user session * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void logoutUserTest() throws ApiException { + public void logoutUserTest() { api.logoutUser().block(); // TODO: test validations @@ -148,12 +126,9 @@ public class UserApiTest { * Updated user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void updateUserTest() throws ApiException { + public void updateUserTest() { String username = null; User user = null; api.updateUser(username, user).block(); From 2b88a1d26f8962f25d2b350dfbab3de60705ad98 Mon Sep 17 00:00:00 2001 From: raghuraman1 Date: Sun, 21 Oct 2018 19:54:17 +0530 Subject: [PATCH 12/35] Boolean conversion for maven plugin (#1252) * saving the fixes. Used commons-configuration2 for org.apache.commons.configuration2.PropertiesConfiguration. It makes the configuration easier to read amongst other benefits * removing tabs * updating and simplifying based on sugegstion from William. This should now fix across all generators * upgraded pom * added some javadocs for the new method --- .../codegen/plugin/CodeGenMojo.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java index ffc4c843300..a46e58849d7 100644 --- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java +++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java @@ -35,6 +35,7 @@ import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -571,6 +572,7 @@ public class CodeGenMojo extends AbstractMojo { } return; } + adjustAdditionalProperties(config); try { new DefaultGenerator().opts(input).generate(); } catch (Exception e) { @@ -608,4 +610,30 @@ public class CodeGenMojo extends AbstractMojo { } } } + /** + * This method enables conversion of true/false strings in + * config.additionalProperties (configuration/configOptions) to proper booleans. + * This enables mustache files to handle the properties better. + * + * @param config + */ + private void adjustAdditionalProperties(final CodegenConfig config) { + Map configAdditionalProperties = config.additionalProperties(); + Set keySet = configAdditionalProperties.keySet(); + for (String key : keySet) { + Object value = configAdditionalProperties.get(key); + if (value != null) { + if (value instanceof String) { + String stringValue = (String) value; + if (stringValue.equalsIgnoreCase("true")) { + configAdditionalProperties.put(key, Boolean.TRUE); + } else if (stringValue.equalsIgnoreCase("false")) { + configAdditionalProperties.put(key, Boolean.FALSE); + } + } + } else { + configAdditionalProperties.put(key, Boolean.FALSE); + } + } + } } From a55533c1784557d4bb77a7e57c735a6fb215cf33 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 22 Oct 2018 12:52:52 +0800 Subject: [PATCH 13/35] Add "servers" support to Ruby API client (#1280) * update ruby samples with OAS3 spec * add server support to ruby api client * minor format change * minor format fix, skip form models * better exception and add test for invaid value * remove exception test code --- bin/openapi3/ruby-client-petstore.sh | 2 +- bin/utils/ensure-up-to-date | 2 +- .../codegen/utils/URLPathUtils.java | 2 +- .../ruby-client/configuration.mustache | 65 ++++++++++++++++ ...ith-fake-endpoints-models-for-testing.yaml | 23 +++++- samples/client/petstore/ruby/docs/FakeApi.md | 8 +- samples/client/petstore/ruby/docs/StoreApi.md | 2 +- samples/client/petstore/ruby/docs/UserApi.md | 8 +- .../ruby/lib/petstore/api/fake_api.rb | 10 ++- .../ruby/lib/petstore/api/store_api.rb | 2 + .../ruby/lib/petstore/api/user_api.rb | 8 ++ .../ruby/lib/petstore/configuration.rb | 75 +++++++++++++++++++ .../ruby/lib/petstore/models/body4.rb | 12 +-- .../ruby/lib/petstore/models/format_test.rb | 19 ----- .../petstore/ruby/spec/configuration_spec.rb | 30 ++++++++ 15 files changed, 229 insertions(+), 39 deletions(-) diff --git a/bin/openapi3/ruby-client-petstore.sh b/bin/openapi3/ruby-client-petstore.sh index 76c321582b0..67420ee1df5 100755 --- a/bin/openapi3/ruby-client-petstore.sh +++ b/bin/openapi3/ruby-client-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@" +ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby -DskipFormModel=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 7ce762d807e..f7b86a587f9 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -10,7 +10,7 @@ echo "Please press CTRL+C to stop or the script will continue in 5 seconds." sleep 5 # LIST OF SCRIPTS: -./bin/ruby-client-petstore.sh > /dev/null 2>&1 +./bin/openapi3/ruby-client-petstore.sh > /dev/null 2>&1 ./bin/java-petstore-all.sh > /dev/null 2>&1 ./bin/java-jaxrs-petstore-server-all.sh > /dev/null 2>&1 ./bin/spring-all-pestore.sh > /dev/null 2>&1 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java index fdfa6fdfd6b..26030abbe1b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java @@ -168,7 +168,7 @@ public class URLPathUtils { */ public static String getHost(OpenAPI openAPI) { if (openAPI.getServers() != null && openAPI.getServers().size() > 0) { - return sanitizeUrl(openAPI.getServers().get(0).getUrl()); + return sanitizeUrl(getServerURL(openAPI.getServers().get(0)).toString()); } return LOCAL_HOST; } diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache index 7c7e1d82dc5..dcfb0004228 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache @@ -219,5 +219,70 @@ module {{moduleName}} {{/authMethods}} } end + + # Returns an array of Server setting + def server_settings + [ + {{#servers}} + { + url: "{{{url}}}", + description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", + {{#variables}} + {{#-first}} + variables: { + {{/-first}} + {{{name}}}: { + description: "{{{description}}}{{^description}}No descriptoin provided{{/description}}", + default_value: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + enum_values: [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + }{{^-last}},{{/-last}} + {{#-last}} + } + {{/-last}} + {{/variables}} + }{{^-last}},{{/-last}} + {{/servers}} + ] + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}) + servers = server_settings + + # check array index out of bound + if (index < 0 || index > servers.size) + fail ArgumentError "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (server[:variables][name][:enum_values].include? variables[name]) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end end end 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 78ba11aaebc..8614ee5b56e 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 @@ -968,7 +968,28 @@ paths: required: - requiredFile servers: - - url: 'http://petstore.swagger.io:80/v2' + - url: 'http://{server}.swagger.io:{port}/v2' + description: petstore server + variables: + server: + enum: + - 'petstore' + - 'qa-petstore' + - 'dev-petstore' + default: 'petstore' + port: + enum: + - 80 + - 8080 + default: 80 + - url: https://api.gigantic-server.com:8080/{version} + description: The production API server + variables: + version: + enum: + - 'v1' + - 'v2' + default: 'v2' components: requestBodies: UserArray: diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index b27a909ce86..a0a9023412d 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -58,7 +58,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* @@ -104,7 +104,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* @@ -150,7 +150,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* @@ -196,7 +196,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 2ebdc4ddc0e..464c8dbb854 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -185,7 +185,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index ae8f3fad0f1..8981435d9d9 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -53,7 +53,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined @@ -95,7 +95,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined @@ -137,7 +137,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined @@ -353,7 +353,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index cc1bdddf5ea..9a03e8be6a6 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -46,6 +46,8 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -93,6 +95,8 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -140,6 +144,8 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -187,6 +193,8 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -585,7 +593,7 @@ module Petstore # query parameters query_params = {} - query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :csv) if !opts[:'enum_query_string_array'].nil? + query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :multi) if !opts[:'enum_query_string_array'].nil? query_params[:'enum_query_string'] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil? query_params[:'enum_query_integer'] = opts[:'enum_query_integer'] if !opts[:'enum_query_integer'].nil? query_params[:'enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil? diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index a7a77e842e7..55d208a244c 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -208,6 +208,8 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 95fd5fe257f..bbacd07c453 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -50,6 +50,8 @@ module Petstore # header parameters header_params = {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -98,6 +100,8 @@ module Petstore # header parameters header_params = {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -146,6 +150,8 @@ module Petstore # header parameters header_params = {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} @@ -404,6 +410,8 @@ module Petstore # header parameters header_params = {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 8811d01ffb9..63b8dce9e59 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -226,5 +226,80 @@ module Petstore }, } end + + # Returns an array of Server setting + def server_settings + [ + { + url: "http://{server}.swagger.io:{port}/v2", + description: "petstore server", + variables: { + server: { + description: "No descriptoin provided", + default_value: "petstore", + enum_values: [ + "petstore", + "qa-petstore", + "dev-petstore" + ] + }, + port: { + description: "No descriptoin provided", + default_value: "80", + enum_values: [ + "80", + "8080" + ] + } + } + }, + { + url: "https://api.gigantic-server.com:8080/{version}", + description: "The production API server", + variables: { + version: { + description: "No descriptoin provided", + default_value: "v2", + enum_values: [ + "v1", + "v2" + ] + } + } + } + ] + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}) + servers = server_settings + + # check array index out of bound + if (index < 0 || index > servers.size) + fail ArgumentError "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (server[:variables][name][:enum_values].include? variables[name]) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/body4.rb b/samples/client/petstore/ruby/lib/petstore/models/body4.rb index 7c0387d9b37..7b0954a6061 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/body4.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/body4.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore +#OpenAPI Petstore #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 3.0.0-SNAPSHOT + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT =end @@ -29,7 +29,7 @@ module Petstore end # Attribute type mapping. - def self.swagger_types + def self.openapi_types { :'param' => :'String', :'param2' => :'String' @@ -102,7 +102,7 @@ module Petstore # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| + self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index 98a903e3123..5539c10c6c7 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -195,10 +195,6 @@ module Petstore invalid_properties.push('invalid value for "byte", byte cannot be nil.') end - if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/) - invalid_properties.push('invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.') - end - if @date.nil? invalid_properties.push('invalid value for "date", date cannot be nil.') end @@ -234,7 +230,6 @@ module Petstore return false if !@double.nil? && @double < 67.8 return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i) return false if @byte.nil? - return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/) return false if @date.nil? return false if @password.nil? return false if @password.to_s.length > 64 @@ -326,20 +321,6 @@ module Petstore @string = string end - # Custom attribute writer method with validation - # @param [Object] byte Value to be assigned - def byte=(byte) - if byte.nil? - fail ArgumentError, 'byte cannot be nil' - end - - if byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/) - fail ArgumentError, 'invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.' - end - - @byte = byte - end - # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) diff --git a/samples/client/petstore/ruby/spec/configuration_spec.rb b/samples/client/petstore/ruby/spec/configuration_spec.rb index 45637e30d6d..e7f9eb39727 100644 --- a/samples/client/petstore/ruby/spec/configuration_spec.rb +++ b/samples/client/petstore/ruby/spec/configuration_spec.rb @@ -22,4 +22,34 @@ describe Petstore::Configuration do end end end + + describe 'server settings' do + it 'should return an array of server settings' do + expect(config.auth_settings).not_to be_empty + end + + it 'should get the first url' do + url = config.server_url(0, server: "dev-petstore", port: "8080") + expect(url).to eq("http://dev-petstore.swagger.io:8080/v2") + end + + it 'should get the first url with default values' do + url = config.server_url(0) + expect(url).to eq("http://petstore.swagger.io:80/v2") + end + + it 'should get the second url with default values' do + url = config.server_url(1) + expect(url).to eq("https://api.gigantic-server.com:8080/v2") + end + + it 'should get the second url' do + url = config.server_url(1, version: "v1") + expect(url).to eq("https://api.gigantic-server.com:8080/v1") + end + + it 'should raise error due to invalid enum value' do + expect{config.server_url(1, version: "v6")}.to raise_error(ArgumentError) + end + end end From 8507916d569a8614286708d45a3cbae20e4da6f2 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 22 Oct 2018 22:11:50 +0800 Subject: [PATCH 14/35] Update migrated generators in the migration guide (#1283) --- docs/migration-from-swagger-codegen.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/migration-from-swagger-codegen.md b/docs/migration-from-swagger-codegen.md index f2452b3bbbc..d40976c9667 100644 --- a/docs/migration-from-swagger-codegen.md +++ b/docs/migration-from-swagger-codegen.md @@ -247,9 +247,10 @@ If your API client is using named parameters in the function call (e.g. Perl req The following gnereators are not yet fully migrated and tested - ~~rust-server~~ (migrated) -- `apex` (migration scheduled in Jul/Aug 2018) +- ~~`apex`~~ (migrated) -and we welcome contributions from the community to help with the migration +and we welcome contributions from the community to help with the migration. +UPDATE: all generators have been successfullly migrated. [Back to OpenAPI-Generator's README page](../README.md) From 111a3626b210a63a915b7ded76a1afe6ef5d80d2 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 23 Oct 2018 16:34:27 +0800 Subject: [PATCH 15/35] update scala akka dependencies (#1294) --- .../main/resources/scala-akka-client/build.sbt.mustache | 6 +++--- .../src/main/resources/scala-akka-client/pom.mustache | 8 ++++---- .../client/petstore/scala-akka/.openapi-generator/VERSION | 2 +- samples/client/petstore/scala-akka/build.sbt | 6 +++--- samples/client/petstore/scala-akka/pom.xml | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/build.sbt.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/build.sbt.mustache index 971bc97364b..265a9791dbb 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/build.sbt.mustache @@ -5,12 +5,12 @@ scalaVersion := "2.11.12" libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.3.2", - "com.typesafe.akka" %% "akka-actor" % "2.5.8", + "com.typesafe.akka" %% "akka-actor" % "2.5.17", "io.spray" % "spray-client" % "1.3.1", "joda-time" % "joda-time" % "2.9.9", - "org.json4s" %% "json4s-jackson" % "3.5.3", + "org.json4s" %% "json4s-jackson" % "3.5.4", // test dependencies - "org.scalatest" %% "scalatest" % "3.0.4" % "test", + "org.scalatest" %% "scalatest" % "3.0.5" % "test", "junit" % "junit" % "4.12" % "test" ) diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache index 0cc69bdc424..e984593572b 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache @@ -16,14 +16,14 @@ 1.8 2.11.12 - 3.5.3 + 3.5.4 3.2.11 1.3.1 - 2.5.8 + 2.5.17 2.9.9 4.12 - 3.0.4 + 3.0.5 3.3.1 @@ -240,4 +240,4 @@ - \ No newline at end of file + diff --git a/samples/client/petstore/scala-akka/.openapi-generator/VERSION b/samples/client/petstore/scala-akka/.openapi-generator/VERSION index f4cb97d56ce..a6527129083 100644 --- a/samples/client/petstore/scala-akka/.openapi-generator/VERSION +++ b/samples/client/petstore/scala-akka/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.1-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/scala-akka/build.sbt b/samples/client/petstore/scala-akka/build.sbt index 8574db359f4..bc950c32fbe 100644 --- a/samples/client/petstore/scala-akka/build.sbt +++ b/samples/client/petstore/scala-akka/build.sbt @@ -5,12 +5,12 @@ scalaVersion := "2.11.12" libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.3.2", - "com.typesafe.akka" %% "akka-actor" % "2.5.8", + "com.typesafe.akka" %% "akka-actor" % "2.5.17", "io.spray" % "spray-client" % "1.3.1", "joda-time" % "joda-time" % "2.9.9", - "org.json4s" %% "json4s-jackson" % "3.5.3", + "org.json4s" %% "json4s-jackson" % "3.5.4", // test dependencies - "org.scalatest" %% "scalatest" % "3.0.4" % "test", + "org.scalatest" %% "scalatest" % "3.0.5" % "test", "junit" % "junit" % "4.12" % "test" ) diff --git a/samples/client/petstore/scala-akka/pom.xml b/samples/client/petstore/scala-akka/pom.xml index 264dad8d1a5..b5ff62feb17 100644 --- a/samples/client/petstore/scala-akka/pom.xml +++ b/samples/client/petstore/scala-akka/pom.xml @@ -16,14 +16,14 @@ 1.8 2.11.12 - 3.5.3 + 3.5.4 3.2.11 1.3.1 - 2.5.8 + 2.5.17 2.9.9 4.12 - 3.0.4 + 3.0.5 3.3.1 @@ -240,4 +240,4 @@ - \ No newline at end of file + From 51d2e4bd4caaf7c0c3e1c6a3f8e618fe3b3b95c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Tue, 23 Oct 2018 10:42:10 +0200 Subject: [PATCH 16/35] [TypeScript] typescript-axios: Added possibility to add custom axios instance. (#1274) * typescript-axios: Added possibility to add custom axios instance. This comes in handy if you want to use mocks in tests. * typescript-axios: aligned to fetch API for custom instance --- .../resources/typescript-axios/api.mustache | 14 +- .../builds/default/.openapi-generator/VERSION | 2 +- .../typescript-axios/builds/default/api.ts | 170 +++++++++--------- .../es6-target/.openapi-generator/VERSION | 2 +- .../typescript-axios/builds/es6-target/api.ts | 170 +++++++++--------- .../.openapi-generator/VERSION | 2 +- .../builds/with-interfaces/api.ts | 170 +++++++++--------- .../.openapi-generator/VERSION | 2 +- .../builds/with-npm-version/api.ts | 170 +++++++++--------- .../tests/default/dist/PetApi.js | 11 +- .../tests/default/dist/PetApiFactory.js | 19 +- .../tests/default/dist/StoreApi.js | 11 +- .../tests/default/dist/StoreApiFactory.js | 11 +- .../tests/default/test/PetApi.ts | 15 +- .../tests/default/test/PetApiFactory.ts | 23 ++- .../tests/default/test/StoreApi.ts | 15 +- .../tests/default/test/StoreApiFactory.ts | 16 +- 17 files changed, 444 insertions(+), 379 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache index 7d11e17ea03..7e2ed1c5f3f 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache @@ -4,7 +4,7 @@ import * as url from "url"; import { Configuration } from "./configuration"; -import axios, { AxiosPromise } from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); @@ -37,7 +37,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; @@ -255,9 +255,9 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { const localVarAxiosArgs = {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -271,7 +271,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * {{&description}}{{/description}} * @export */ -export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string) { +export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { {{#operation}} /** @@ -286,7 +286,7 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas * @throws {RequiredError} */ {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { - return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(basePath); + return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(axios, basePath); }, {{/operation}} }; @@ -346,7 +346,7 @@ export class {{classname}} extends BaseAPI { * @memberof {{classname}} */ public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { - return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.basePath); + return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.axios, this.basePath); } {{/operation}} diff --git a/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION index c791c986fbb..a6527129083 100644 --- a/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/default/api.ts b/samples/client/petstore/typescript-axios/builds/default/api.ts index 0bac23ab041..833d16653e1 100644 --- a/samples/client/petstore/typescript-axios/builds/default/api.ts +++ b/samples/client/petstore/typescript-axios/builds/default/api.ts @@ -15,7 +15,7 @@ import * as url from "url"; import { Configuration } from "./configuration"; -import axios, { AxiosPromise } from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); @@ -48,7 +48,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; @@ -714,9 +714,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -729,9 +729,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + deletePet(petId: number, apiKey?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -743,9 +743,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -757,9 +757,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByTags(tags: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -771,9 +771,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + getPetById(petId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -785,9 +785,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -801,9 +801,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -817,9 +817,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -831,7 +831,7 @@ export const PetApiFp = function(configuration?: Configuration) { * PetApi - factory interface * @export */ -export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * @@ -841,7 +841,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(pet: Pet, options?: any) { - return PetApiFp(configuration).addPet(pet, options)(basePath); + return PetApiFp(configuration).addPet(pet, options)(axios, basePath); }, /** * @@ -852,7 +852,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + return PetApiFp(configuration).deletePet(petId, apiKey, options)(axios, basePath); }, /** * Multiple status values can be provided with comma separated strings @@ -862,7 +862,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + return PetApiFp(configuration).findPetsByStatus(status, options)(axios, basePath); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -872,7 +872,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any) { - return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + return PetApiFp(configuration).findPetsByTags(tags, options)(axios, basePath); }, /** * Returns a single pet @@ -882,7 +882,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any) { - return PetApiFp(configuration).getPetById(petId, options)(basePath); + return PetApiFp(configuration).getPetById(petId, options)(axios, basePath); }, /** * @@ -892,7 +892,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(pet: Pet, options?: any) { - return PetApiFp(configuration).updatePet(pet, options)(basePath); + return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); }, /** * @@ -904,7 +904,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(axios, basePath); }, /** * @@ -916,7 +916,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(axios, basePath); }, }; }; @@ -937,7 +937,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public addPet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); } /** @@ -950,7 +950,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.axios, this.basePath); } /** @@ -962,7 +962,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.axios, this.basePath); } /** @@ -974,7 +974,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByTags(tags: Array, options?: any) { - return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.axios, this.basePath); } /** @@ -986,7 +986,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public getPetById(petId: number, options?: any) { - return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + return PetApiFp(this.configuration).getPetById(petId, options)(this.axios, this.basePath); } /** @@ -998,7 +998,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); } /** @@ -1012,7 +1012,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.axios, this.basePath); } /** @@ -1026,7 +1026,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.axios, this.basePath); } } @@ -1190,9 +1190,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + deleteOrder(orderId: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1203,9 +1203,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + getInventory(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }> { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1217,9 +1217,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + getOrderById(orderId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1231,9 +1231,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1245,7 +1245,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * StoreApi - factory interface * @export */ -export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1255,7 +1255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any) { - return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + return StoreApiFp(configuration).deleteOrder(orderId, options)(axios, basePath); }, /** * Returns a map of status codes to quantities @@ -1264,7 +1264,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any) { - return StoreApiFp(configuration).getInventory(options)(basePath); + return StoreApiFp(configuration).getInventory(options)(axios, basePath); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1274,7 +1274,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any) { - return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + return StoreApiFp(configuration).getOrderById(orderId, options)(axios, basePath); }, /** * @@ -1284,7 +1284,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(order: Order, options?: any) { - return StoreApiFp(configuration).placeOrder(order, options)(basePath); + return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); }, }; }; @@ -1305,7 +1305,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public deleteOrder(orderId: string, options?: any) { - return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.axios, this.basePath); } /** @@ -1316,7 +1316,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getInventory(options?: any) { - return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + return StoreApiFp(this.configuration).getInventory(options)(this.axios, this.basePath); } /** @@ -1328,7 +1328,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getOrderById(orderId: number, options?: any) { - return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.axios, this.basePath); } /** @@ -1340,7 +1340,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public placeOrder(order: Order, options?: any) { - return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); } } @@ -1655,9 +1655,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1669,9 +1669,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithArrayInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1683,9 +1683,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithListInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1697,9 +1697,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + deleteUser(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1711,9 +1711,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + getUserByName(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1726,9 +1726,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + loginUser(username: string, password: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1739,9 +1739,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - logoutUser(options?: any): (basePath?: string) => AxiosPromise { + logoutUser(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1754,9 +1754,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1768,7 +1768,7 @@ export const UserApiFp = function(configuration?: Configuration) { * UserApi - factory interface * @export */ -export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * This can only be done by the logged in user. @@ -1778,7 +1778,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(user: User, options?: any) { - return UserApiFp(configuration).createUser(user, options)(basePath); + return UserApiFp(configuration).createUser(user, options)(axios, basePath); }, /** * @@ -1788,7 +1788,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); }, /** * @@ -1798,7 +1798,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1808,7 +1808,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any) { - return UserApiFp(configuration).deleteUser(username, options)(basePath); + return UserApiFp(configuration).deleteUser(username, options)(axios, basePath); }, /** * @@ -1818,7 +1818,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any) { - return UserApiFp(configuration).getUserByName(username, options)(basePath); + return UserApiFp(configuration).getUserByName(username, options)(axios, basePath); }, /** * @@ -1829,7 +1829,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any) { - return UserApiFp(configuration).loginUser(username, password, options)(basePath); + return UserApiFp(configuration).loginUser(username, password, options)(axios, basePath); }, /** * @@ -1838,7 +1838,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any) { - return UserApiFp(configuration).logoutUser(options)(basePath); + return UserApiFp(configuration).logoutUser(options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1849,7 +1849,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, user: User, options?: any) { - return UserApiFp(configuration).updateUser(username, user, options)(basePath); + return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); }, }; }; @@ -1870,7 +1870,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUser(user: User, options?: any) { - return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); } /** @@ -1882,7 +1882,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); } /** @@ -1894,7 +1894,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); } /** @@ -1906,7 +1906,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public deleteUser(username: string, options?: any) { - return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + return UserApiFp(this.configuration).deleteUser(username, options)(this.axios, this.basePath); } /** @@ -1918,7 +1918,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public getUserByName(username: string, options?: any) { - return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + return UserApiFp(this.configuration).getUserByName(username, options)(this.axios, this.basePath); } /** @@ -1931,7 +1931,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public loginUser(username: string, password: string, options?: any) { - return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + return UserApiFp(this.configuration).loginUser(username, password, options)(this.axios, this.basePath); } /** @@ -1942,7 +1942,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public logoutUser(options?: any) { - return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + return UserApiFp(this.configuration).logoutUser(options)(this.axios, this.basePath); } /** @@ -1955,7 +1955,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public updateUser(username: string, user: User, options?: any) { - return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); } } diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION index c791c986fbb..a6527129083 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts index 0bac23ab041..833d16653e1 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts @@ -15,7 +15,7 @@ import * as url from "url"; import { Configuration } from "./configuration"; -import axios, { AxiosPromise } from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); @@ -48,7 +48,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; @@ -714,9 +714,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -729,9 +729,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + deletePet(petId: number, apiKey?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -743,9 +743,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -757,9 +757,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByTags(tags: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -771,9 +771,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + getPetById(petId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -785,9 +785,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -801,9 +801,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -817,9 +817,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -831,7 +831,7 @@ export const PetApiFp = function(configuration?: Configuration) { * PetApi - factory interface * @export */ -export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * @@ -841,7 +841,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(pet: Pet, options?: any) { - return PetApiFp(configuration).addPet(pet, options)(basePath); + return PetApiFp(configuration).addPet(pet, options)(axios, basePath); }, /** * @@ -852,7 +852,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + return PetApiFp(configuration).deletePet(petId, apiKey, options)(axios, basePath); }, /** * Multiple status values can be provided with comma separated strings @@ -862,7 +862,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + return PetApiFp(configuration).findPetsByStatus(status, options)(axios, basePath); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -872,7 +872,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any) { - return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + return PetApiFp(configuration).findPetsByTags(tags, options)(axios, basePath); }, /** * Returns a single pet @@ -882,7 +882,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any) { - return PetApiFp(configuration).getPetById(petId, options)(basePath); + return PetApiFp(configuration).getPetById(petId, options)(axios, basePath); }, /** * @@ -892,7 +892,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(pet: Pet, options?: any) { - return PetApiFp(configuration).updatePet(pet, options)(basePath); + return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); }, /** * @@ -904,7 +904,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(axios, basePath); }, /** * @@ -916,7 +916,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(axios, basePath); }, }; }; @@ -937,7 +937,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public addPet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); } /** @@ -950,7 +950,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.axios, this.basePath); } /** @@ -962,7 +962,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.axios, this.basePath); } /** @@ -974,7 +974,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByTags(tags: Array, options?: any) { - return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.axios, this.basePath); } /** @@ -986,7 +986,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public getPetById(petId: number, options?: any) { - return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + return PetApiFp(this.configuration).getPetById(petId, options)(this.axios, this.basePath); } /** @@ -998,7 +998,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); } /** @@ -1012,7 +1012,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.axios, this.basePath); } /** @@ -1026,7 +1026,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.axios, this.basePath); } } @@ -1190,9 +1190,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + deleteOrder(orderId: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1203,9 +1203,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + getInventory(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }> { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1217,9 +1217,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + getOrderById(orderId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1231,9 +1231,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1245,7 +1245,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * StoreApi - factory interface * @export */ -export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1255,7 +1255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any) { - return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + return StoreApiFp(configuration).deleteOrder(orderId, options)(axios, basePath); }, /** * Returns a map of status codes to quantities @@ -1264,7 +1264,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any) { - return StoreApiFp(configuration).getInventory(options)(basePath); + return StoreApiFp(configuration).getInventory(options)(axios, basePath); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1274,7 +1274,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any) { - return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + return StoreApiFp(configuration).getOrderById(orderId, options)(axios, basePath); }, /** * @@ -1284,7 +1284,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(order: Order, options?: any) { - return StoreApiFp(configuration).placeOrder(order, options)(basePath); + return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); }, }; }; @@ -1305,7 +1305,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public deleteOrder(orderId: string, options?: any) { - return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.axios, this.basePath); } /** @@ -1316,7 +1316,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getInventory(options?: any) { - return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + return StoreApiFp(this.configuration).getInventory(options)(this.axios, this.basePath); } /** @@ -1328,7 +1328,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getOrderById(orderId: number, options?: any) { - return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.axios, this.basePath); } /** @@ -1340,7 +1340,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public placeOrder(order: Order, options?: any) { - return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); } } @@ -1655,9 +1655,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1669,9 +1669,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithArrayInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1683,9 +1683,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithListInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1697,9 +1697,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + deleteUser(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1711,9 +1711,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + getUserByName(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1726,9 +1726,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + loginUser(username: string, password: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1739,9 +1739,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - logoutUser(options?: any): (basePath?: string) => AxiosPromise { + logoutUser(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1754,9 +1754,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1768,7 +1768,7 @@ export const UserApiFp = function(configuration?: Configuration) { * UserApi - factory interface * @export */ -export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * This can only be done by the logged in user. @@ -1778,7 +1778,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(user: User, options?: any) { - return UserApiFp(configuration).createUser(user, options)(basePath); + return UserApiFp(configuration).createUser(user, options)(axios, basePath); }, /** * @@ -1788,7 +1788,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); }, /** * @@ -1798,7 +1798,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1808,7 +1808,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any) { - return UserApiFp(configuration).deleteUser(username, options)(basePath); + return UserApiFp(configuration).deleteUser(username, options)(axios, basePath); }, /** * @@ -1818,7 +1818,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any) { - return UserApiFp(configuration).getUserByName(username, options)(basePath); + return UserApiFp(configuration).getUserByName(username, options)(axios, basePath); }, /** * @@ -1829,7 +1829,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any) { - return UserApiFp(configuration).loginUser(username, password, options)(basePath); + return UserApiFp(configuration).loginUser(username, password, options)(axios, basePath); }, /** * @@ -1838,7 +1838,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any) { - return UserApiFp(configuration).logoutUser(options)(basePath); + return UserApiFp(configuration).logoutUser(options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1849,7 +1849,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, user: User, options?: any) { - return UserApiFp(configuration).updateUser(username, user, options)(basePath); + return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); }, }; }; @@ -1870,7 +1870,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUser(user: User, options?: any) { - return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); } /** @@ -1882,7 +1882,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); } /** @@ -1894,7 +1894,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); } /** @@ -1906,7 +1906,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public deleteUser(username: string, options?: any) { - return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + return UserApiFp(this.configuration).deleteUser(username, options)(this.axios, this.basePath); } /** @@ -1918,7 +1918,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public getUserByName(username: string, options?: any) { - return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + return UserApiFp(this.configuration).getUserByName(username, options)(this.axios, this.basePath); } /** @@ -1931,7 +1931,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public loginUser(username: string, password: string, options?: any) { - return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + return UserApiFp(this.configuration).loginUser(username, password, options)(this.axios, this.basePath); } /** @@ -1942,7 +1942,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public logoutUser(options?: any) { - return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + return UserApiFp(this.configuration).logoutUser(options)(this.axios, this.basePath); } /** @@ -1955,7 +1955,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public updateUser(username: string, user: User, options?: any) { - return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); } } diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION index c791c986fbb..a6527129083 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts index e47d90f0e19..ef559218184 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts @@ -15,7 +15,7 @@ import * as url from "url"; import { Configuration } from "./configuration"; -import axios, { AxiosPromise } from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); @@ -48,7 +48,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; @@ -714,9 +714,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -729,9 +729,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + deletePet(petId: number, apiKey?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -743,9 +743,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -757,9 +757,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByTags(tags: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -771,9 +771,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + getPetById(petId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -785,9 +785,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -801,9 +801,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -817,9 +817,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -831,7 +831,7 @@ export const PetApiFp = function(configuration?: Configuration) { * PetApi - factory interface * @export */ -export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * @@ -841,7 +841,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(pet: Pet, options?: any) { - return PetApiFp(configuration).addPet(pet, options)(basePath); + return PetApiFp(configuration).addPet(pet, options)(axios, basePath); }, /** * @@ -852,7 +852,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + return PetApiFp(configuration).deletePet(petId, apiKey, options)(axios, basePath); }, /** * Multiple status values can be provided with comma separated strings @@ -862,7 +862,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + return PetApiFp(configuration).findPetsByStatus(status, options)(axios, basePath); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -872,7 +872,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any) { - return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + return PetApiFp(configuration).findPetsByTags(tags, options)(axios, basePath); }, /** * Returns a single pet @@ -882,7 +882,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any) { - return PetApiFp(configuration).getPetById(petId, options)(basePath); + return PetApiFp(configuration).getPetById(petId, options)(axios, basePath); }, /** * @@ -892,7 +892,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(pet: Pet, options?: any) { - return PetApiFp(configuration).updatePet(pet, options)(basePath); + return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); }, /** * @@ -904,7 +904,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(axios, basePath); }, /** * @@ -916,7 +916,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(axios, basePath); }, }; }; @@ -1030,7 +1030,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public addPet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); } /** @@ -1043,7 +1043,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.axios, this.basePath); } /** @@ -1055,7 +1055,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.axios, this.basePath); } /** @@ -1067,7 +1067,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public findPetsByTags(tags: Array, options?: any) { - return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.axios, this.basePath); } /** @@ -1079,7 +1079,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public getPetById(petId: number, options?: any) { - return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + return PetApiFp(this.configuration).getPetById(petId, options)(this.axios, this.basePath); } /** @@ -1091,7 +1091,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public updatePet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); } /** @@ -1105,7 +1105,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.axios, this.basePath); } /** @@ -1119,7 +1119,7 @@ export class PetApi extends BaseAPI implements PetApiInterface { * @memberof PetApi */ public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.axios, this.basePath); } } @@ -1283,9 +1283,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + deleteOrder(orderId: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1296,9 +1296,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + getInventory(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }> { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1310,9 +1310,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + getOrderById(orderId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1324,9 +1324,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1338,7 +1338,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * StoreApi - factory interface * @export */ -export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1348,7 +1348,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any) { - return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + return StoreApiFp(configuration).deleteOrder(orderId, options)(axios, basePath); }, /** * Returns a map of status codes to quantities @@ -1357,7 +1357,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any) { - return StoreApiFp(configuration).getInventory(options)(basePath); + return StoreApiFp(configuration).getInventory(options)(axios, basePath); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1367,7 +1367,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any) { - return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + return StoreApiFp(configuration).getOrderById(orderId, options)(axios, basePath); }, /** * @@ -1377,7 +1377,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(order: Order, options?: any) { - return StoreApiFp(configuration).placeOrder(order, options)(basePath); + return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); }, }; }; @@ -1445,7 +1445,7 @@ export class StoreApi extends BaseAPI implements StoreApiInterface { * @memberof StoreApi */ public deleteOrder(orderId: string, options?: any) { - return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.axios, this.basePath); } /** @@ -1456,7 +1456,7 @@ export class StoreApi extends BaseAPI implements StoreApiInterface { * @memberof StoreApi */ public getInventory(options?: any) { - return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + return StoreApiFp(this.configuration).getInventory(options)(this.axios, this.basePath); } /** @@ -1468,7 +1468,7 @@ export class StoreApi extends BaseAPI implements StoreApiInterface { * @memberof StoreApi */ public getOrderById(orderId: number, options?: any) { - return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.axios, this.basePath); } /** @@ -1480,7 +1480,7 @@ export class StoreApi extends BaseAPI implements StoreApiInterface { * @memberof StoreApi */ public placeOrder(order: Order, options?: any) { - return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); } } @@ -1795,9 +1795,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1809,9 +1809,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithArrayInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1823,9 +1823,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithListInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1837,9 +1837,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + deleteUser(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1851,9 +1851,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + getUserByName(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1866,9 +1866,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + loginUser(username: string, password: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1879,9 +1879,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - logoutUser(options?: any): (basePath?: string) => AxiosPromise { + logoutUser(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1894,9 +1894,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1908,7 +1908,7 @@ export const UserApiFp = function(configuration?: Configuration) { * UserApi - factory interface * @export */ -export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * This can only be done by the logged in user. @@ -1918,7 +1918,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(user: User, options?: any) { - return UserApiFp(configuration).createUser(user, options)(basePath); + return UserApiFp(configuration).createUser(user, options)(axios, basePath); }, /** * @@ -1928,7 +1928,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); }, /** * @@ -1938,7 +1938,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1948,7 +1948,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any) { - return UserApiFp(configuration).deleteUser(username, options)(basePath); + return UserApiFp(configuration).deleteUser(username, options)(axios, basePath); }, /** * @@ -1958,7 +1958,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any) { - return UserApiFp(configuration).getUserByName(username, options)(basePath); + return UserApiFp(configuration).getUserByName(username, options)(axios, basePath); }, /** * @@ -1969,7 +1969,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any) { - return UserApiFp(configuration).loginUser(username, password, options)(basePath); + return UserApiFp(configuration).loginUser(username, password, options)(axios, basePath); }, /** * @@ -1978,7 +1978,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any) { - return UserApiFp(configuration).logoutUser(options)(basePath); + return UserApiFp(configuration).logoutUser(options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1989,7 +1989,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, user: User, options?: any) { - return UserApiFp(configuration).updateUser(username, user, options)(basePath); + return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); }, }; }; @@ -2099,7 +2099,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public createUser(user: User, options?: any) { - return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); } /** @@ -2111,7 +2111,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); } /** @@ -2123,7 +2123,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); } /** @@ -2135,7 +2135,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public deleteUser(username: string, options?: any) { - return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + return UserApiFp(this.configuration).deleteUser(username, options)(this.axios, this.basePath); } /** @@ -2147,7 +2147,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public getUserByName(username: string, options?: any) { - return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + return UserApiFp(this.configuration).getUserByName(username, options)(this.axios, this.basePath); } /** @@ -2160,7 +2160,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public loginUser(username: string, password: string, options?: any) { - return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + return UserApiFp(this.configuration).loginUser(username, password, options)(this.axios, this.basePath); } /** @@ -2171,7 +2171,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public logoutUser(options?: any) { - return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + return UserApiFp(this.configuration).logoutUser(options)(this.axios, this.basePath); } /** @@ -2184,7 +2184,7 @@ export class UserApi extends BaseAPI implements UserApiInterface { * @memberof UserApi */ public updateUser(username: string, user: User, options?: any) { - return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); } } diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION index c791c986fbb..a6527129083 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts index 0bac23ab041..833d16653e1 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts @@ -15,7 +15,7 @@ import * as url from "url"; import { Configuration } from "./configuration"; -import axios, { AxiosPromise } from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); @@ -48,7 +48,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; @@ -714,9 +714,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -729,9 +729,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + deletePet(petId: number, apiKey?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -743,9 +743,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -757,9 +757,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + findPetsByTags(tags: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -771,9 +771,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + getPetById(petId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -785,9 +785,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -801,9 +801,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -817,9 +817,9 @@ export const PetApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -831,7 +831,7 @@ export const PetApiFp = function(configuration?: Configuration) { * PetApi - factory interface * @export */ -export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * @@ -841,7 +841,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(pet: Pet, options?: any) { - return PetApiFp(configuration).addPet(pet, options)(basePath); + return PetApiFp(configuration).addPet(pet, options)(axios, basePath); }, /** * @@ -852,7 +852,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + return PetApiFp(configuration).deletePet(petId, apiKey, options)(axios, basePath); }, /** * Multiple status values can be provided with comma separated strings @@ -862,7 +862,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + return PetApiFp(configuration).findPetsByStatus(status, options)(axios, basePath); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -872,7 +872,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any) { - return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + return PetApiFp(configuration).findPetsByTags(tags, options)(axios, basePath); }, /** * Returns a single pet @@ -882,7 +882,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any) { - return PetApiFp(configuration).getPetById(petId, options)(basePath); + return PetApiFp(configuration).getPetById(petId, options)(axios, basePath); }, /** * @@ -892,7 +892,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(pet: Pet, options?: any) { - return PetApiFp(configuration).updatePet(pet, options)(basePath); + return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); }, /** * @@ -904,7 +904,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(axios, basePath); }, /** * @@ -916,7 +916,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(axios, basePath); }, }; }; @@ -937,7 +937,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public addPet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); } /** @@ -950,7 +950,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public deletePet(petId: number, apiKey?: string, options?: any) { - return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.axios, this.basePath); } /** @@ -962,7 +962,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { - return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.axios, this.basePath); } /** @@ -974,7 +974,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public findPetsByTags(tags: Array, options?: any) { - return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.axios, this.basePath); } /** @@ -986,7 +986,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public getPetById(petId: number, options?: any) { - return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + return PetApiFp(this.configuration).getPetById(petId, options)(this.axios, this.basePath); } /** @@ -998,7 +998,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePet(pet: Pet, options?: any) { - return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); } /** @@ -1012,7 +1012,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { - return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.axios, this.basePath); } /** @@ -1026,7 +1026,7 @@ export class PetApi extends BaseAPI { * @memberof PetApi */ public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { - return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.axios, this.basePath); } } @@ -1190,9 +1190,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + deleteOrder(orderId: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1203,9 +1203,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + getInventory(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }> { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1217,9 +1217,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + getOrderById(orderId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1231,9 +1231,9 @@ export const StoreApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1245,7 +1245,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * StoreApi - factory interface * @export */ -export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1255,7 +1255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any) { - return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + return StoreApiFp(configuration).deleteOrder(orderId, options)(axios, basePath); }, /** * Returns a map of status codes to quantities @@ -1264,7 +1264,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any) { - return StoreApiFp(configuration).getInventory(options)(basePath); + return StoreApiFp(configuration).getInventory(options)(axios, basePath); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1274,7 +1274,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any) { - return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + return StoreApiFp(configuration).getOrderById(orderId, options)(axios, basePath); }, /** * @@ -1284,7 +1284,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(order: Order, options?: any) { - return StoreApiFp(configuration).placeOrder(order, options)(basePath); + return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); }, }; }; @@ -1305,7 +1305,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public deleteOrder(orderId: string, options?: any) { - return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.axios, this.basePath); } /** @@ -1316,7 +1316,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getInventory(options?: any) { - return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + return StoreApiFp(this.configuration).getInventory(options)(this.axios, this.basePath); } /** @@ -1328,7 +1328,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public getOrderById(orderId: number, options?: any) { - return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.axios, this.basePath); } /** @@ -1340,7 +1340,7 @@ export class StoreApi extends BaseAPI { * @memberof StoreApi */ public placeOrder(order: Order, options?: any) { - return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); } } @@ -1655,9 +1655,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1669,9 +1669,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithArrayInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1683,9 +1683,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + createUsersWithListInput(user: Array, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1697,9 +1697,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + deleteUser(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1711,9 +1711,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + getUserByName(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1726,9 +1726,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + loginUser(username: string, password: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1739,9 +1739,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - logoutUser(options?: any): (basePath?: string) => AxiosPromise { + logoutUser(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1754,9 +1754,9 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise { const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); - return (basePath: string = BASE_PATH) => { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) return axios.request(axiosRequestArgs); }; @@ -1768,7 +1768,7 @@ export const UserApiFp = function(configuration?: Configuration) { * UserApi - factory interface * @export */ -export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * This can only be done by the logged in user. @@ -1778,7 +1778,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(user: User, options?: any) { - return UserApiFp(configuration).createUser(user, options)(basePath); + return UserApiFp(configuration).createUser(user, options)(axios, basePath); }, /** * @@ -1788,7 +1788,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); }, /** * @@ -1798,7 +1798,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1808,7 +1808,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any) { - return UserApiFp(configuration).deleteUser(username, options)(basePath); + return UserApiFp(configuration).deleteUser(username, options)(axios, basePath); }, /** * @@ -1818,7 +1818,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any) { - return UserApiFp(configuration).getUserByName(username, options)(basePath); + return UserApiFp(configuration).getUserByName(username, options)(axios, basePath); }, /** * @@ -1829,7 +1829,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any) { - return UserApiFp(configuration).loginUser(username, password, options)(basePath); + return UserApiFp(configuration).loginUser(username, password, options)(axios, basePath); }, /** * @@ -1838,7 +1838,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any) { - return UserApiFp(configuration).logoutUser(options)(basePath); + return UserApiFp(configuration).logoutUser(options)(axios, basePath); }, /** * This can only be done by the logged in user. @@ -1849,7 +1849,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, user: User, options?: any) { - return UserApiFp(configuration).updateUser(username, user, options)(basePath); + return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); }, }; }; @@ -1870,7 +1870,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUser(user: User, options?: any) { - return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); } /** @@ -1882,7 +1882,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithArrayInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); } /** @@ -1894,7 +1894,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public createUsersWithListInput(user: Array, options?: any) { - return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); } /** @@ -1906,7 +1906,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public deleteUser(username: string, options?: any) { - return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + return UserApiFp(this.configuration).deleteUser(username, options)(this.axios, this.basePath); } /** @@ -1918,7 +1918,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public getUserByName(username: string, options?: any) { - return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + return UserApiFp(this.configuration).getUserByName(username, options)(this.axios, this.basePath); } /** @@ -1931,7 +1931,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public loginUser(username: string, password: string, options?: any) { - return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + return UserApiFp(this.configuration).loginUser(username, password, options)(this.axios, this.basePath); } /** @@ -1942,7 +1942,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public logoutUser(options?: any) { - return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + return UserApiFp(this.configuration).logoutUser(options)(this.axios, this.basePath); } /** @@ -1955,7 +1955,7 @@ export class UserApi extends BaseAPI { * @memberof UserApi */ public updateUser(username: string, user: User, options?: any) { - return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); } } diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js b/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js index 4549c1b75a6..6952694afb9 100644 --- a/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js +++ b/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js @@ -2,13 +2,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = require("chai"); var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +var axios_1 = require("axios"); describe("PetApi", function () { - function runSuite(description, requestOptions) { + function runSuite(description, requestOptions, customAxiosInstance) { describe(description, function () { var api; var fixture = createTestFixture(); beforeEach(function () { - api = new typescript_axios_petstore_1.PetApi(); + api = new typescript_axios_petstore_1.PetApi(undefined, undefined, customAxiosInstance); }); it("should add and delete Pet", function () { return api.addPet(fixture, requestOptions).then(function () { }); @@ -52,6 +53,12 @@ describe("PetApi", function () { credentials: "include", mode: "cors" }); + runSuite("without custom axios instance"); + runSuite("with custom axios instance", {}, axios_1.default); + runSuite("with custom request options and custom axios instance", { + credentials: "include", + mode: "cors" + }, axios_1.default); }); function createTestFixture(ts) { if (ts === void 0) { ts = Date.now(); } diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js b/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js index 45c2e265fa7..8b2f7183299 100644 --- a/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js +++ b/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = require("chai"); var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore"); +var axios_1 = require("axios"); var config; before(function () { config = new typescript_axios_petstore_2.Configuration(); @@ -18,23 +19,23 @@ before(function () { config.password = "bar"; }); describe("PetApiFactory", function () { - function runSuite(description, requestOptions) { + function runSuite(description, requestOptions, customAxiosInstance) { describe(description, function () { var fixture = createTestFixture(); it("should add and delete Pet", function () { - return typescript_axios_petstore_1.PetApiFactory(config) + return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance) .addPet(fixture, requestOptions) .then(function () { }); }); it("should get Pet by ID", function () { - return typescript_axios_petstore_1.PetApiFactory(config) + return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then(function (result) { return chai_1.expect(result.data).to.deep.equal(fixture); }); }); it("should update Pet by ID", function () { - return typescript_axios_petstore_1.PetApiFactory(config) + return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then(function (result) { result.data.name = "newname"; @@ -50,10 +51,10 @@ describe("PetApiFactory", function () { }); }); it("should delete Pet", function () { - return typescript_axios_petstore_1.PetApiFactory(config).deletePet(fixture.id, requestOptions); + return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance).deletePet(fixture.id, requestOptions); }); it("should not contain deleted Pet", function () { - return typescript_axios_petstore_1.PetApiFactory(config) + return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then(function (result) { return chai_1.expect(result.data).to.not.exist; @@ -68,6 +69,12 @@ describe("PetApiFactory", function () { credentials: "include", mode: "cors" }); + runSuite("without custom axios instance"); + runSuite("with custom axios instance", {}, axios_1.default); + runSuite("with custom request options and custom axios instance", { + credentials: "include", + mode: "cors" + }, axios_1.default); }); function createTestFixture(ts) { if (ts === void 0) { ts = Date.now(); } diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js index dfb8d744b5e..943b5108e24 100644 --- a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js +++ b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js @@ -2,12 +2,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = require("chai"); var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +var axios_1 = require("axios"); describe("StoreApi", function () { - function runSuite(description, requestOptions) { + function runSuite(description, requestOptions, customAxiosInstance) { describe(description, function () { var api; beforeEach(function () { - api = new typescript_axios_petstore_1.StoreApi(); + api = new typescript_axios_petstore_1.StoreApi(undefined, undefined, customAxiosInstance); }); it("should get inventory", function () { return api @@ -23,4 +24,10 @@ describe("StoreApi", function () { credentials: "include", mode: "cors" }); + runSuite("without custom axios instance"); + runSuite("with custom axios instance", {}, axios_1.default); + runSuite("with custom request options and custom axios instance", { + credentials: "include", + mode: "cors" + }, axios_1.default); }); diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js index e53401fe88b..76e5b5bd428 100644 --- a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js +++ b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = require("chai"); var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore"); +var axios_1 = require("axios"); var config; before(function () { config = new typescript_axios_petstore_2.Configuration(); @@ -18,10 +19,10 @@ before(function () { config.password = "bar"; }); describe("StoreApiFactory", function () { - function runSuite(description, requestOptions) { + function runSuite(description, requestOptions, customAxiosInstance) { describe(description, function () { it("should get inventory", function () { - return typescript_axios_petstore_1.StoreApiFactory(config) + return typescript_axios_petstore_1.StoreApiFactory(config, undefined, customAxiosInstance) .getInventory(requestOptions) .then(function (result) { chai_1.expect(Object.keys(result.data)).to.not.be.empty; @@ -34,4 +35,10 @@ describe("StoreApiFactory", function () { credentials: "include", mode: "cors" }); + runSuite("without custom axios instance"); + runSuite("with custom axios instance", {}, axios_1.default); + runSuite("with custom request options and custom axios instance", { + credentials: "include", + mode: "cors" + }, axios_1.default); }); diff --git a/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts b/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts index 26c24a0de7e..a5464667e5a 100644 --- a/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts +++ b/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts @@ -1,15 +1,15 @@ import { expect } from "chai"; import { PetApi, Pet, Category } from "@swagger/typescript-axios-petstore"; -import { AxiosResponse } from "axios"; +import axios, {AxiosInstance, AxiosResponse} from "axios"; describe("PetApi", () => { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any, customAxiosInstance?: AxiosInstance): void { describe(description, () => { let api: PetApi; const fixture: Pet = createTestFixture(); beforeEach(() => { - api = new PetApi(); + api = new PetApi(undefined, undefined, customAxiosInstance); }); it("should add and delete Pet", () => { @@ -63,6 +63,15 @@ describe("PetApi", () => { credentials: "include", mode: "cors" }); + + runSuite("without custom axios instance"); + + runSuite("with custom axios instance",{}, axios); + + runSuite("with custom request options and custom axios instance",{ + credentials: "include", + mode: "cors" + }, axios); }); function createTestFixture(ts = Date.now()) { diff --git a/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts b/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts index 8f4cde55623..bcd42b1ef1e 100644 --- a/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts +++ b/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts @@ -5,7 +5,7 @@ import { Category } from "@swagger/typescript-axios-petstore"; import { Configuration } from "@swagger/typescript-axios-petstore"; -import { AxiosResponse } from "axios"; +import axios, {AxiosInstance, AxiosResponse} from "axios"; let config: Configuration; @@ -24,18 +24,18 @@ before(function() { }); describe("PetApiFactory", () => { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any, customAxiosInstance?: AxiosInstance): void { describe(description, () => { const fixture: Pet = createTestFixture(); it("should add and delete Pet", () => { - return PetApiFactory(config) + return PetApiFactory(config, undefined, customAxiosInstance) .addPet(fixture, requestOptions) .then(() => {}); }); it("should get Pet by ID", () => { - return PetApiFactory(config) + return PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then((result: AxiosResponse) => { return expect(result.data).to.deep.equal(fixture); @@ -43,7 +43,7 @@ describe("PetApiFactory", () => { }); it("should update Pet by ID", () => { - return PetApiFactory(config) + return PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then((result: AxiosResponse) => { result.data.name = "newname"; @@ -60,11 +60,11 @@ describe("PetApiFactory", () => { }); it("should delete Pet", () => { - return PetApiFactory(config).deletePet(fixture.id, requestOptions); + return PetApiFactory(config, undefined, customAxiosInstance).deletePet(fixture.id, requestOptions); }); it("should not contain deleted Pet", () => { - return PetApiFactory(config) + return PetApiFactory(config, undefined, customAxiosInstance) .getPetById(fixture.id, requestOptions) .then( (result: AxiosResponse) => { @@ -84,6 +84,15 @@ describe("PetApiFactory", () => { credentials: "include", mode: "cors" }); + + runSuite("without custom axios instance"); + + runSuite("with custom axios instance",{}, axios); + + runSuite("with custom request options and custom axios instance",{ + credentials: "include", + mode: "cors" + }, axios); }); function createTestFixture(ts = Date.now()) { diff --git a/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts b/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts index ae3ce4efdc1..6ae2d0a4918 100644 --- a/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts +++ b/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; import { StoreApi } from "@swagger/typescript-axios-petstore"; -import { AxiosResponse } from "axios"; +import axios, {AxiosInstance, AxiosResponse} from "axios"; describe("StoreApi", function() { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any, customAxiosInstance?: AxiosInstance): void { describe(description, () => { let api: StoreApi; beforeEach(function() { - api = new StoreApi(); + api = new StoreApi(undefined, undefined, customAxiosInstance); }); it("should get inventory", function() { @@ -27,4 +27,13 @@ describe("StoreApi", function() { credentials: "include", mode: "cors" }); + + runSuite("without custom axios instance"); + + runSuite("with custom axios instance",{}, axios); + + runSuite("with custom request options and custom axios instance",{ + credentials: "include", + mode: "cors" + }, axios); }); diff --git a/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts b/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts index 0ff7e4b99d4..37758eefe5c 100644 --- a/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts +++ b/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts @@ -1,7 +1,8 @@ import { expect } from "chai"; import { StoreApiFactory } from "@swagger/typescript-axios-petstore"; import { Configuration } from "@swagger/typescript-axios-petstore"; -import { AxiosResponse } from "axios"; +import {AxiosInstance, AxiosResponse} from "axios"; +import axios from "axios"; let config: Configuration; @@ -20,10 +21,10 @@ before(function() { }); describe("StoreApiFactory", function() { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any, customAxiosInstance?: AxiosInstance): void { describe(description, () => { it("should get inventory", function() { - return StoreApiFactory(config) + return StoreApiFactory(config, undefined, customAxiosInstance) .getInventory(requestOptions) .then((result: AxiosResponse<{ [key: string]: number }>) => { expect(Object.keys(result.data)).to.not.be.empty; @@ -38,4 +39,13 @@ describe("StoreApiFactory", function() { credentials: "include", mode: "cors" }); + + runSuite("without custom axios instance"); + + runSuite("with custom axios instance",{}, axios); + + runSuite("with custom request options and custom axios instance",{ + credentials: "include", + mode: "cors" + }, axios); }); From bb056ccf3d7c7790d8e4ba4bec11576bd62e6b57 Mon Sep 17 00:00:00 2001 From: Dec12 | Fujigon Date: Tue, 23 Oct 2018 17:51:55 +0900 Subject: [PATCH 17/35] [General] fix InlineModelResolver's logic and use openapi-generator's InlineModelResolver, so that nested "required" works correctly (#1200) * fix InlineModelResolver's logis and use openapi-generator's InlineModelResolver, so that nested "required" works correctly * add "required" to nested model schema * update ensure-up-to-date to include openapi v3's jaxrs * change test required field * fix sample shell script, hide timestamp * fix NPE * move test case to petstore-with-fake-endpoints-models-for-testing.yaml * fix jaxrs-jersey (oas3) example generate shell script to use petstore-with-fake-endpoints-models-for-testing.yaml * add default value * re-generate samples --- bin/openapi3/jaxrs-jersey-petstore.sh | 2 +- bin/utils/ensure-up-to-date | 1 + .../codegen/InlineModelResolver.java | 4 + .../codegen/config/CodegenConfigurator.java | 1 - ...ith-fake-endpoints-models-for-testing.yaml | 3 + ...ith-fake-endpoints-models-for-testing.yaml | 23 + .../OpenAPIClient/.openapi-generator/VERSION | 2 +- .../Lib/OpenAPIClient/README.md | 2 + .../Lib/OpenAPIClient/docs/Inline_object.md | 10 + .../Lib/OpenAPIClient/docs/Inline_object_1.md | 10 + .../Lib/OpenAPIClient/docs/StoreApi.md | 2 +- .../Lib/OpenAPIClient/docs/UserApi.md | 8 +- .../Org/OpenAPITools/Model/InlineObject.cs | 54 ++ .../Org/OpenAPITools/Model/InlineObject1.cs | 54 ++ .../Lib/OpenAPIClient/vendor/packages.config | 5 + .../csharp/OpenAPIClient/docs/Category.md | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../.openapi-generator/VERSION | 2 +- .../OpenAPIClientNet35/docs/Category.md | 2 +- .../csharp/OpenAPIClientNet35/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 +- .../.openapi-generator/VERSION | 2 +- .../OpenAPIClientNet40/docs/Category.md | 2 +- .../csharp/OpenAPIClientNet40/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 +- .../.openapi-generator/VERSION | 2 +- .../OpenAPIClientNetStandard/docs/Category.md | 2 +- .../docs/DefaultApi.md | 63 ++ .../OpenAPIClientNetStandard/docs/Foo.md | 9 + .../docs/InlineObject.md | 10 + .../docs/InlineObject1.md | 10 + .../docs/InlineObject2.md | 10 + .../docs/InlineObject3.md | 22 + .../docs/InlineObject4.md | 10 + .../docs/InlineObject5.md | 10 + .../docs/InlineResponseDefault.md | 9 + .../OpenAPIClientNetStandard/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 289 +++++++ .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../src/Org.OpenAPITools/Model/Foo.cs | 120 +++ .../Org.OpenAPITools/Model/InlineObject.cs | 130 +++ .../Org.OpenAPITools/Model/InlineObject1.cs | 130 +++ .../Org.OpenAPITools/Model/InlineObject2.cs | 186 ++++ .../Org.OpenAPITools/Model/InlineObject3.cs | 372 ++++++++ .../Org.OpenAPITools/Model/InlineObject4.cs | 151 ++++ .../Org.OpenAPITools/Model/InlineObject5.cs | 143 ++++ .../Model/InlineResponseDefault.cs | 112 +++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 +- .../.openapi-generator/VERSION | 2 +- .../docs/Category.md | 2 +- .../docs/DefaultApi.md | 63 ++ .../docs/Foo.md | 9 + .../docs/InlineObject.md | 10 + .../docs/InlineObject1.md | 10 + .../docs/InlineObject2.md | 10 + .../docs/InlineObject3.md | 22 + .../docs/InlineObject4.md | 10 + .../docs/InlineObject5.md | 10 + .../docs/InlineResponseDefault.md | 9 + .../docs/MapTest.md | 2 +- .../Api/DefaultApiTests.cs | 80 ++ .../Org.OpenAPITools.Test/Model/FooTests.cs | 80 ++ .../Model/InlineObject1Tests.cs | 88 ++ .../Model/InlineObject2Tests.cs | 88 ++ .../Model/InlineObject3Tests.cs | 184 ++++ .../Model/InlineObject4Tests.cs | 88 ++ .../Model/InlineObject5Tests.cs | 88 ++ .../Model/InlineObjectTests.cs | 88 ++ .../Model/InlineResponseDefaultTests.cs | 80 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 289 +++++++ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../src/Org.OpenAPITools/Model/Foo.cs | 155 ++++ .../Org.OpenAPITools/Model/InlineObject.cs | 165 ++++ .../Org.OpenAPITools/Model/InlineObject1.cs | 165 ++++ .../Org.OpenAPITools/Model/InlineObject2.cs | 221 +++++ .../Org.OpenAPITools/Model/InlineObject3.cs | 487 +++++++++++ .../Org.OpenAPITools/Model/InlineObject4.cs | 186 ++++ .../Org.OpenAPITools/Model/InlineObject5.cs | 178 ++++ .../Model/InlineResponseDefault.cs | 147 ++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 +- .../petstore/go/go-petstore/api/openapi.yaml | 7 +- .../petstore/go/go-petstore/docs/Category.md | 2 +- .../petstore/go/go-petstore/model_category.go | 2 +- .../lib/OpenAPIPetstore/Model.hs | 11 +- .../lib/OpenAPIPetstore/ModelLens.hs | 2 +- .../petstore/haskell-http-client/openapi.yaml | 7 +- .../haskell-http-client/tests/Instances.hs | 2 +- .../openapitools/client/model/Category.java | 4 +- .../openapitools/client/model/Category.java | 4 +- .../java/google-api-client/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../petstore/java/jersey1/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/jersey2-java6/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/jersey2-java8/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../petstore/java/jersey2/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/okhttp-gson/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/rest-assured/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../petstore/java/resteasy/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../resttemplate-withXml/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/resttemplate/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../openapitools/client/model/Category.java | 4 +- .../java/retrofit2-play24/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 5 +- .../java/retrofit2-play25/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 5 +- .../java/retrofit2-play26/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 5 +- .../petstore/java/retrofit2/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/retrofit2rx/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../java/retrofit2rx2/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../petstore/java/vertx/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../petstore/java/webclient/docs/Category.md | 2 +- .../openapitools/client/model/Category.java | 4 +- .../OpenAPIClient-php/docs/Model/Category.md | 2 +- .../OpenAPIClient-php/lib/Model/Category.php | 9 +- samples/client/petstore/ruby/docs/Category.md | 2 +- .../ruby/lib/petstore/models/category.rb | 7 + .../OpenAPIClient/.openapi-generator/VERSION | 2 +- .../petstore/csharp/OpenAPIClient/README.md | 9 + .../csharp/OpenAPIClient/docs/Category.md | 2 +- .../csharp/OpenAPIClient/docs/DefaultApi.md | 63 ++ .../petstore/csharp/OpenAPIClient/docs/Foo.md | 9 + .../csharp/OpenAPIClient/docs/InlineObject.md | 10 + .../OpenAPIClient/docs/InlineObject1.md | 10 + .../OpenAPIClient/docs/InlineObject2.md | 10 + .../OpenAPIClient/docs/InlineObject3.md | 22 + .../OpenAPIClient/docs/InlineObject4.md | 10 + .../OpenAPIClient/docs/InlineObject5.md | 10 + .../docs/InlineResponseDefault.md | 9 + .../csharp/OpenAPIClient/docs/MapTest.md | 2 +- .../Api/DefaultApiTests.cs | 80 ++ .../Org.OpenAPITools.Test/Model/FooTests.cs | 80 ++ .../Model/InlineObject1Tests.cs | 88 ++ .../Model/InlineObject2Tests.cs | 88 ++ .../Model/InlineObject3Tests.cs | 184 ++++ .../Model/InlineObject4Tests.cs | 88 ++ .../Model/InlineObject5Tests.cs | 88 ++ .../Model/InlineObjectTests.cs | 88 ++ .../Model/InlineResponseDefaultTests.cs | 80 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 289 +++++++ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 19 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../src/Org.OpenAPITools/Model/Foo.cs | 132 +++ .../Org.OpenAPITools/Model/InlineObject.cs | 142 +++ .../Org.OpenAPITools/Model/InlineObject1.cs | 142 +++ .../Org.OpenAPITools/Model/InlineObject2.cs | 198 +++++ .../Org.OpenAPITools/Model/InlineObject3.cs | 464 ++++++++++ .../Org.OpenAPITools/Model/InlineObject4.cs | 163 ++++ .../Org.OpenAPITools/Model/InlineObject5.cs | 155 ++++ .../Model/InlineResponseDefault.cs | 124 +++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 +- .../petstore/php/OpenAPIClient-php/README.md | 15 +- .../OpenAPIClient-php/docs/Api/DefaultApi.md | 52 ++ .../OpenAPIClient-php/docs/Model/Category.md | 2 +- .../php/OpenAPIClient-php/docs/Model/Foo.md | 10 + .../docs/Model/InlineObject.md | 11 + .../docs/Model/InlineObject1.md | 11 + .../docs/Model/InlineObject2.md | 11 + .../docs/Model/InlineObject3.md | 23 + .../docs/Model/InlineObject4.md | 11 + .../docs/Model/InlineObject5.md | 11 + .../docs/Model/InlineResponseDefault.md | 10 + .../OpenAPIClient-php/lib/Api/DefaultApi.php | 357 ++++++++ .../OpenAPIClient-php/lib/Model/Category.php | 9 +- .../php/OpenAPIClient-php/lib/Model/Foo.php | 297 +++++++ .../lib/Model/InlineObject.php | 327 +++++++ .../lib/Model/InlineObject1.php | 327 +++++++ .../lib/Model/InlineObject2.php | 385 +++++++++ .../lib/Model/InlineObject3.php | 805 ++++++++++++++++++ .../lib/Model/InlineObject4.php | 333 ++++++++ .../lib/Model/InlineObject5.php | 330 +++++++ .../lib/Model/InlineResponseDefault.php | 297 +++++++ .../test/Api/DefaultApiTest.php | 83 ++ .../OpenAPIClient-php/test/Model/FooTest.php | 85 ++ .../{Body1Test.php => InlineObject1Test.php} | 12 +- .../{Body2Test.php => InlineObject2Test.php} | 12 +- .../{Body3Test.php => InlineObject3Test.php} | 12 +- .../{Body4Test.php => InlineObject4Test.php} | 12 +- .../{Body5Test.php => InlineObject5Test.php} | 12 +- .../{BodyTest.php => InlineObjectTest.php} | 12 +- .../test/Model/InlineResponseDefaultTest.php | 85 ++ .../java/org/openapitools/model/Category.java | 5 +- .../java/org/openapitools/model/Category.java | 7 +- .../jaxrs-jersey/.openapi-generator/VERSION | 2 +- .../org/openapitools/api/AnotherFakeApi.java | 70 ++ .../api/AnotherFakeApiService.java | 21 + .../org/openapitools/api/ApiException.java | 2 +- .../org/openapitools/api/ApiOriginFilter.java | 2 +- .../openapitools/api/ApiResponseMessage.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 249 ++++++ .../org/openapitools/api/FakeApiService.java | 40 + .../api/FakeClassnameTestApi.java | 72 ++ .../api/FakeClassnameTestApiService.java | 21 + .../gen/java/org/openapitools/api/FooApi.java | 69 ++ .../org/openapitools/api/FooApiService.java | 21 + .../openapitools/api/NotFoundException.java | 2 +- .../gen/java/org/openapitools/api/PetApi.java | 12 +- .../org/openapitools/api/PetApiService.java | 2 +- .../java/org/openapitools/api/StoreApi.java | 10 +- .../org/openapitools/api/StoreApiService.java | 2 +- .../java/org/openapitools/api/StringUtil.java | 2 +- .../java/org/openapitools/api/UserApi.java | 2 +- .../org/openapitools/api/UserApiService.java | 2 +- .../model/AdditionalPropertiesClass.java | 136 +++ .../java/org/openapitools/model/Animal.java | 120 +++ .../org/openapitools/model/AnimalFarm.java | 66 ++ .../model/ArrayOfArrayOfNumberOnly.java | 103 +++ .../openapitools/model/ArrayOfNumberOnly.java | 103 +++ .../org/openapitools/model/ArrayTest.java | 169 ++++ .../openapitools/model/Capitalization.java | 217 +++++ .../gen/java/org/openapitools/model/Cat.java | 94 ++ .../java/org/openapitools/model/Category.java | 16 +- .../org/openapitools/model/ClassModel.java | 93 ++ .../java/org/openapitools/model/Client.java | 92 ++ .../gen/java/org/openapitools/model/Dog.java | 94 ++ .../org/openapitools/model/EnumArrays.java | 190 +++++ .../org/openapitools/model/EnumClass.java | 55 ++ .../java/org/openapitools/model/EnumTest.java | 323 +++++++ .../model/FileSchemaTestClass.java | 127 +++ .../gen/java/org/openapitools/model/Foo.java | 92 ++ .../org/openapitools/model/FormatTest.java | 410 +++++++++ .../openapitools/model/HasOnlyReadOnly.java | 99 +++ .../org/openapitools/model/InlineObject.java | 117 +++ .../org/openapitools/model/InlineObject1.java | 118 +++ .../org/openapitools/model/InlineObject2.java | 192 +++++ .../org/openapitools/model/InlineObject3.java | 433 ++++++++++ .../org/openapitools/model/InlineObject4.java | 119 +++ .../org/openapitools/model/InlineObject5.java | 119 +++ .../model/InlineResponseDefault.java | 93 ++ .../java/org/openapitools/model/MapTest.java | 234 +++++ ...ropertiesAndAdditionalPropertiesClass.java | 156 ++++ .../openapitools/model/Model200Response.java | 118 +++ .../openapitools/model/ModelApiResponse.java | 13 +- .../org/openapitools/model/ModelReturn.java | 93 ++ .../gen/java/org/openapitools/model/Name.java | 151 ++++ .../org/openapitools/model/NumberOnly.java | 93 ++ .../java/org/openapitools/model/Order.java | 17 +- .../openapitools/model/OuterComposite.java | 143 ++++ .../org/openapitools/model/OuterEnum.java | 55 ++ .../gen/java/org/openapitools/model/Pet.java | 13 +- .../org/openapitools/model/ReadOnlyFirst.java | 108 +++ .../openapitools/model/SpecialModelName.java | 92 ++ .../openapitools/model/StringBooleanMap.java | 65 ++ .../gen/java/org/openapitools/model/Tag.java | 11 +- .../gen/java/org/openapitools/model/User.java | 23 +- .../AnotherFakeApiServiceFactory.java | 13 + .../api/factories/FakeApiServiceFactory.java | 13 + .../FakeClassnameTestApiServiceFactory.java | 13 + .../api/factories/FooApiServiceFactory.java | 13 + .../api/factories/PetApiServiceFactory.java | 2 +- .../api/factories/StoreApiServiceFactory.java | 2 +- .../api/factories/UserApiServiceFactory.java | 2 +- .../api/impl/AnotherFakeApiServiceImpl.java | 25 + .../api/impl/FakeApiServiceImpl.java | 88 ++ .../impl/FakeClassnameTestApiServiceImpl.java | 25 + .../api/impl/FooApiServiceImpl.java | 25 + .../api/impl/PetApiServiceImpl.java | 2 +- .../api/impl/StoreApiServiceImpl.java | 2 +- .../api/impl/UserApiServiceImpl.java | 2 +- .../java/org/openapitools/model/Category.java | 5 +- .../src/main/openapi/openapi.yaml | 7 +- .../java/org/openapitools/model/Category.java | 5 +- .../jaxrs-spec/src/main/openapi/openapi.yaml | 7 +- .../java/org/openapitools/model/Category.java | 7 +- .../java/org/openapitools/model/Category.java | 7 +- .../java/org/openapitools/model/Category.java | 7 +- .../java/org/openapitools/model/Category.java | 7 +- .../php-ze-ph/src/App/DTO/Category.php | 2 +- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../openapitools/api/PetApiController.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../openapitools/api/PetApiController.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../org/openapitools/api/PetApiDelegate.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../java/org/openapitools/model/Category.java | 5 +- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../org/openapitools/api/PetApiDelegate.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../src/main/resources/openapi.yaml | 7 +- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/model/Category.java | 5 +- 310 files changed, 17989 insertions(+), 346 deletions(-) create mode 100644 samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object.md create mode 100644 samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object_1.md create mode 100644 samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject.cs create mode 100644 samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject1.cs create mode 100644 samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/vendor/packages.config create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/DefaultApi.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Foo.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject1.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject2.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject3.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject4.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject5.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineResponseDefault.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/DefaultApi.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Foo.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject1.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject2.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject3.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject4.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject5.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineResponseDefault.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/DefaultApi.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Foo.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject1.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject2.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject3.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject4.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject5.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineResponseDefault.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FooTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/DefaultApi.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Foo.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject1.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject2.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject3.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject4.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject5.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineResponseDefault.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Foo.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject1.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject2.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject3.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject4.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject5.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooTests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject1.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject2.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject3.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject4.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject5.cs create mode 100644 samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Foo.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject1.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject2.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject3.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject4.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject5.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/DefaultApiTest.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/FooTest.php rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{Body1Test.php => InlineObject1Test.php} (87%) rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{Body2Test.php => InlineObject2Test.php} (87%) rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{Body3Test.php => InlineObject3Test.php} (92%) rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{Body4Test.php => InlineObject4Test.php} (87%) rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{Body5Test.php => InlineObject5Test.php} (87%) rename samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/{BodyTest.php => InlineObjectTest.php} (87%) create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/InlineResponseDefaultTest.php create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AnimalFarm.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayTest.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Capitalization.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Cat.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ClassModel.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Client.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Dog.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumArrays.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumClass.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumTest.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FileSchemaTestClass.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Foo.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FormatTest.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject1.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject2.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject3.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject4.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject5.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineResponseDefault.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MapTest.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Model200Response.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelReturn.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Name.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/NumberOnly.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterComposite.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterEnum.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ReadOnlyFirst.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/SpecialModelName.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/StringBooleanMap.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java diff --git a/bin/openapi3/jaxrs-jersey-petstore.sh b/bin/openapi3/jaxrs-jersey-petstore.sh index 86487d172cc..08d88d9b9c1 100755 --- a/bin/openapi3/jaxrs-jersey-petstore.sh +++ b/bin/openapi3/jaxrs-jersey-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey $@" +ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey -DhideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index f7b86a587f9..2411f06e42a 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -13,6 +13,7 @@ sleep 5 ./bin/openapi3/ruby-client-petstore.sh > /dev/null 2>&1 ./bin/java-petstore-all.sh > /dev/null 2>&1 ./bin/java-jaxrs-petstore-server-all.sh > /dev/null 2>&1 +./bin/openapi3/jaxrs-jersey-petstore.sh > /dev/null 2>&1 ./bin/spring-all-pestore.sh > /dev/null 2>&1 ./bin/kotlin-client-petstore.sh > /dev/null 2>&1 ./bin/kotlin-client-string.sh > /dev/null 2>&1 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index a17b13c15a6..571a63bd1bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -500,6 +500,7 @@ public class InlineModelResolver { model.setExample(example); model.setName(object.getName()); model.setXml(xml); + model.setRequired(object.getRequired()); if (properties != null) { flattenProperties(properties, path); model.setProperties(properties); @@ -545,6 +546,9 @@ public class InlineModelResolver { public void copyVendorExtensions(Schema source, Schema target) { Map vendorExtensions = source.getExtensions(); + if (vendorExtensions == null) { + return; + } for (String extName : vendorExtensions.keySet()) { target.addExtension(extName, vendorExtensions.get(extName)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index 36399cd8b89..6a991b9c959 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -549,7 +549,6 @@ public class CodegenConfigurator implements Serializable { final List authorizationValues = AuthParser.parse(auth); ParseOptions options = new ParseOptions(); options.setResolve(true); - options.setFlatten(true); SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options); Set validationMessages = new HashSet<>(result.getMessages()); diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 5fc7ebf0709..8315914ce14 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1049,12 +1049,15 @@ definitions: name: Order Category: type: object + required: + - name properties: id: type: integer format: int64 name: type: string + default: default-name xml: name: Category User: 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 8614ee5b56e..8f937652fd8 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 @@ -17,6 +17,18 @@ tags: - name: user description: Operations about user paths: + /foo: + get: + responses: + default: + description: response + content: + application/json: + schema: + type: object + properties: + string: + $ref: '#/components/schemas/Foo' /pet: post: tags: @@ -1039,6 +1051,14 @@ components: type: http scheme: basic schemas: + Foo: + type: object + properties: + bar: + $ref: '#/components/schemas/Bar' + Bar: + type: string + default: bar Order: type: object properties: @@ -1068,12 +1088,15 @@ components: name: Order Category: type: object + required: + - name properties: id: type: integer format: int64 name: type: string + default: default-name xml: name: Category User: diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/.openapi-generator/VERSION b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/.openapi-generator/VERSION index 096bf47efe3..a6527129083 100644 --- a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/README.md b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/README.md index 6b861dfd723..a58248e1fde 100644 --- a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/README.md @@ -103,6 +103,8 @@ Class | Method | HTTP request | Description - [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md) - [Org.OpenAPITools.Model.Category](docs/Category.md) + - [Org.OpenAPITools.Model.InlineObject](docs/InlineObject.md) + - [Org.OpenAPITools.Model.InlineObject1](docs/InlineObject1.md) - [Org.OpenAPITools.Model.Order](docs/Order.md) - [Org.OpenAPITools.Model.Pet](docs/Pet.md) - [Org.OpenAPITools.Model.Tag](docs/Tag.md) diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object.md b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object.md new file mode 100644 index 00000000000..40e16da1bb7 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Updated name of the pet | [optional] +**Status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object_1.md b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object_1.md new file mode 100644 index 00000000000..2e6d226754e --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/Inline_object_1.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject1 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**File** | **System.IO.Stream** | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/StoreApi.md b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/StoreApi.md index 76334b0ca4d..c49894a3ff1 100644 --- a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/StoreApi.md @@ -251,7 +251,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/UserApi.md index dad1e505005..5ab87ee0d4d 100644 --- a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/docs/UserApi.md @@ -70,7 +70,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -129,7 +129,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -188,7 +188,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -489,7 +489,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject.cs b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject.cs new file mode 100644 index 00000000000..2de88324c58 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject.cs @@ -0,0 +1,54 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// + /// + [DataContract] + public class InlineObject { + /// + /// Updated name of the pet + /// + /// Updated name of the pet + [DataMember(Name="name", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Updated status of the pet + /// + /// Updated status of the pet + [DataMember(Name="status", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class InlineObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject1.cs b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject1.cs new file mode 100644 index 00000000000..03d1fa0c786 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/InlineObject1.cs @@ -0,0 +1,54 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// + /// + [DataContract] + public class InlineObject1 { + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "additionalMetadata")] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="file", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "file")] + public System.IO.Stream File { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class InlineObject1 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/vendor/packages.config b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/vendor/packages.config new file mode 100644 index 00000000000..7b9cf186303 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient/vendor/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Category.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs index a172f36022a..a795fc58c58 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs @@ -30,15 +30,28 @@ namespace Org.OpenAPITools.Model [DataContract] public partial class Category : IEquatable, IValidatableObject { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/Category.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs index 4f7fe5abf8a..e262055d395 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs @@ -30,15 +30,28 @@ namespace Org.OpenAPITools.Model [DataContract] public partial class Category : IEquatable { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs index b9ad7659bcb..bc7166dfbfd 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/Category.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Cat.cs index b9444fb3607..1504638f6f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Cat.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs index a172f36022a..a795fc58c58 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs @@ -30,15 +30,28 @@ namespace Org.OpenAPITools.Model [DataContract] public partial class Category : IEquatable, IValidatableObject { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Dog.cs index 90c181c11b6..ecd67f40b6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Dog.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs index 1c5bfa70198..3f44bcf22ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Category.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/DefaultApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/DefaultApi.md new file mode 100644 index 00000000000..92f2dc125c0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/DefaultApi.md @@ -0,0 +1,63 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FooGet**](DefaultApi.md#fooget) | **GET** /foo | + + + +# **FooGet** +> InlineResponseDefault FooGet () + + + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public void main() + { + var apiInstance = new DefaultApi(); + + try + { + InlineResponseDefault result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Foo.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Foo.md new file mode 100644 index 00000000000..fd84dc2038c --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/Foo.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.Foo +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject.md new file mode 100644 index 00000000000..40e16da1bb7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Updated name of the pet | [optional] +**Status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject1.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject1.md new file mode 100644 index 00000000000..2e6d226754e --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject1.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject1 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**File** | **System.IO.Stream** | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject2.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject2.md new file mode 100644 index 00000000000..c02c78f9b2d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject2.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject2 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumFormStringArray** | **List<string>** | Form parameter enum test (string array) | [optional] +**EnumFormString** | **string** | Form parameter enum test (string) | [optional] [default to EnumFormStringEnum.Efg] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject3.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject3.md new file mode 100644 index 00000000000..192926bbe92 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject3.md @@ -0,0 +1,22 @@ +# Org.OpenAPITools.Model.InlineObject3 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int?** | None | [optional] +**Int32** | **int?** | None | [optional] +**Int64** | **long?** | None | [optional] +**Number** | **decimal?** | None | +**Float** | **float?** | None | [optional] +**Double** | **double?** | None | +**String** | **string** | None | [optional] +**PatternWithoutDelimiter** | **string** | None | +**Byte** | **byte[]** | None | +**Binary** | **System.IO.Stream** | None | [optional] +**Date** | **DateTime?** | None | [optional] +**DateTime** | **DateTime?** | None | [optional] +**Password** | **string** | None | [optional] +**Callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject4.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject4.md new file mode 100644 index 00000000000..c8e00663ee8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject4.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject4 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Param** | **string** | field1 | +**Param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject5.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject5.md new file mode 100644 index 00000000000..a28ff47f2ec --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineObject5.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject5 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**RequiredFile** | **System.IO.Stream** | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineResponseDefault.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineResponseDefault.md new file mode 100644 index 00000000000..8c96fb62ac8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/InlineResponseDefault.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.InlineResponseDefault +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 00000000000..ff0cb9b0b5d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,289 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp.Portable; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + InlineResponseDefault FooGet (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + ApiResponse FooGetWithHttpInfo (); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + System.Threading.Tasks.Task FooGetAsync (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo (); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(String basePath) + { + this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath }; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public IDictionary DefaultHeader() + { + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + public InlineResponseDefault FooGet () + { + ApiResponse localVarResponse = FooGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + public ApiResponse< InlineResponseDefault > FooGetWithHttpInfo () + { + + var localVarPath = "./foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + public async System.Threading.Tasks.Task FooGetAsync () + { + ApiResponse localVarResponse = await FooGetAsyncWithHttpInfo(); + return localVarResponse.Data; + + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + public async System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo () + { + + var localVarPath = "./foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs index 22b8d54d9dc..0c5b31a5ab8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs @@ -28,15 +28,28 @@ namespace Org.OpenAPITools.Model [DataContract] public partial class Category : IEquatable { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 00000000000..ddb699c34f5 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Foo.cs @@ -0,0 +1,120 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + [DataContract] + public partial class Foo : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar"). + public Foo(string bar = "bar") + { + // use default value if no "bar" provided + if (bar == null) + { + this.Bar = "bar"; + } + else + { + this.Bar = bar; + } + } + + /// + /// Gets or Sets Bar + /// + [DataMember(Name="bar", EmitDefaultValue=false)] + public string Bar { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Foo); + } + + /// + /// Returns true if Foo instances are equal + /// + /// Instance of Foo to be compared + /// Boolean + public bool Equals(Foo input) + { + if (input == null) + return false; + + return + ( + this.Bar == input.Bar || + (this.Bar != null && + this.Bar.Equals(input.Bar)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Bar != null) + hashCode = hashCode * 59 + this.Bar.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject.cs new file mode 100644 index 00000000000..10ced6b8325 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject.cs @@ -0,0 +1,130 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject + /// + [DataContract] + public partial class InlineObject : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Updated name of the pet. + /// Updated status of the pet. + public InlineObject(string name = default(string), string status = default(string)) + { + this.Name = name; + this.Status = status; + } + + /// + /// Updated name of the pet + /// + /// Updated name of the pet + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Updated status of the pet + /// + /// Updated status of the pet + [DataMember(Name="status", EmitDefaultValue=false)] + public string Status { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject); + } + + /// + /// Returns true if InlineObject instances are equal + /// + /// Instance of InlineObject to be compared + /// Boolean + public bool Equals(InlineObject input) + { + if (input == null) + return false; + + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.Status != null) + hashCode = hashCode * 59 + this.Status.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject1.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject1.cs new file mode 100644 index 00000000000..65063f5bf48 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject1.cs @@ -0,0 +1,130 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject1 + /// + [DataContract] + public partial class InlineObject1 : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload. + public InlineObject1(string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)) + { + this.AdditionalMetadata = additionalMetadata; + this.File = file; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject1 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject1); + } + + /// + /// Returns true if InlineObject1 instances are equal + /// + /// Instance of InlineObject1 to be compared + /// Boolean + public bool Equals(InlineObject1 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject2.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject2.cs new file mode 100644 index 00000000000..cc99ca7bf97 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject2.cs @@ -0,0 +1,186 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject2 + /// + [DataContract] + public partial class InlineObject2 : IEquatable + { + /// + /// Defines EnumFormStringArray + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringArrayEnum + { + /// + /// Enum GreaterThan for value: > + /// + [EnumMember(Value = ">")] + GreaterThan = 1, + + /// + /// Enum Dollar for value: $ + /// + [EnumMember(Value = "$")] + Dollar = 2 + + } + + + /// + /// Form parameter enum test (string array) + /// + /// Form parameter enum test (string array) + [DataMember(Name="enum_form_string_array", EmitDefaultValue=false)] + public List EnumFormStringArray { get; set; } + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringEnum + { + /// + /// Enum Abc for value: _abc + /// + [EnumMember(Value = "_abc")] + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + [EnumMember(Value = "-efg")] + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + [EnumMember(Value = "(xyz)")] + Xyz = 3 + + } + + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [DataMember(Name="enum_form_string", EmitDefaultValue=false)] + public EnumFormStringEnum? EnumFormString { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Form parameter enum test (string array). + /// Form parameter enum test (string) (default to EnumFormStringEnum.Efg). + public InlineObject2(List enumFormStringArray = default(List), EnumFormStringEnum? enumFormString = EnumFormStringEnum.Efg) + { + this.EnumFormStringArray = enumFormStringArray; + // use default value if no "enumFormString" provided + if (enumFormString == null) + { + this.EnumFormString = EnumFormStringEnum.Efg; + } + else + { + this.EnumFormString = enumFormString; + } + } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject2 {\n"); + sb.Append(" EnumFormStringArray: ").Append(EnumFormStringArray).Append("\n"); + sb.Append(" EnumFormString: ").Append(EnumFormString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject2); + } + + /// + /// Returns true if InlineObject2 instances are equal + /// + /// Instance of InlineObject2 to be compared + /// Boolean + public bool Equals(InlineObject2 input) + { + if (input == null) + return false; + + return + ( + this.EnumFormStringArray == input.EnumFormStringArray || + this.EnumFormStringArray != null && + this.EnumFormStringArray.SequenceEqual(input.EnumFormStringArray) + ) && + ( + this.EnumFormString == input.EnumFormString || + (this.EnumFormString != null && + this.EnumFormString.Equals(input.EnumFormString)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EnumFormStringArray != null) + hashCode = hashCode * 59 + this.EnumFormStringArray.GetHashCode(); + if (this.EnumFormString != null) + hashCode = hashCode * 59 + this.EnumFormString.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject3.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject3.cs new file mode 100644 index 00000000000..504e0b0fe6a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject3.cs @@ -0,0 +1,372 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject3 + /// + [DataContract] + public partial class InlineObject3 : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject3() { } + /// + /// Initializes a new instance of the class. + /// + /// None. + /// None. + /// None. + /// None (required). + /// None. + /// None (required). + /// None. + /// None (required). + /// None (required). + /// None. + /// None. + /// None. + /// None. + /// None. + public InlineObject3(int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), decimal? number = default(decimal?), float? _float = default(float?), double? _double = default(double?), string _string = default(string), string patternWithoutDelimiter = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) + { + // to ensure "number" is required (not null) + if (number == null) + { + throw new InvalidDataException("number is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Number = number; + } + // to ensure "_double" is required (not null) + if (_double == null) + { + throw new InvalidDataException("_double is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Double = _double; + } + // to ensure "patternWithoutDelimiter" is required (not null) + if (patternWithoutDelimiter == null) + { + throw new InvalidDataException("patternWithoutDelimiter is a required property for InlineObject3 and cannot be null"); + } + else + { + this.PatternWithoutDelimiter = patternWithoutDelimiter; + } + // to ensure "_byte" is required (not null) + if (_byte == null) + { + throw new InvalidDataException("_byte is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Byte = _byte; + } + this.Integer = integer; + this.Int32 = int32; + this.Int64 = int64; + this.Float = _float; + this.String = _string; + this.Binary = binary; + this.Date = date; + this.DateTime = dateTime; + this.Password = password; + this.Callback = callback; + } + + /// + /// None + /// + /// None + [DataMember(Name="integer", EmitDefaultValue=false)] + public int? Integer { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int32", EmitDefaultValue=false)] + public int? Int32 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int64", EmitDefaultValue=false)] + public long? Int64 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="number", EmitDefaultValue=false)] + public decimal? Number { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="float", EmitDefaultValue=false)] + public float? Float { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="double", EmitDefaultValue=false)] + public double? Double { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="string", EmitDefaultValue=false)] + public string String { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="pattern_without_delimiter", EmitDefaultValue=false)] + public string PatternWithoutDelimiter { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="byte", EmitDefaultValue=false)] + public byte[] Byte { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="binary", EmitDefaultValue=false)] + public System.IO.Stream Binary { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="date", EmitDefaultValue=false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? Date { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="dateTime", EmitDefaultValue=false)] + public DateTime? DateTime { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="callback", EmitDefaultValue=false)] + public string Callback { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject3 {\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" PatternWithoutDelimiter: ").Append(PatternWithoutDelimiter).Append("\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Callback: ").Append(Callback).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject3); + } + + /// + /// Returns true if InlineObject3 instances are equal + /// + /// Instance of InlineObject3 to be compared + /// Boolean + public bool Equals(InlineObject3 input) + { + if (input == null) + return false; + + return + ( + this.Integer == input.Integer || + (this.Integer != null && + this.Integer.Equals(input.Integer)) + ) && + ( + this.Int32 == input.Int32 || + (this.Int32 != null && + this.Int32.Equals(input.Int32)) + ) && + ( + this.Int64 == input.Int64 || + (this.Int64 != null && + this.Int64.Equals(input.Int64)) + ) && + ( + this.Number == input.Number || + (this.Number != null && + this.Number.Equals(input.Number)) + ) && + ( + this.Float == input.Float || + (this.Float != null && + this.Float.Equals(input.Float)) + ) && + ( + this.Double == input.Double || + (this.Double != null && + this.Double.Equals(input.Double)) + ) && + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ) && + ( + this.PatternWithoutDelimiter == input.PatternWithoutDelimiter || + (this.PatternWithoutDelimiter != null && + this.PatternWithoutDelimiter.Equals(input.PatternWithoutDelimiter)) + ) && + ( + this.Byte == input.Byte || + (this.Byte != null && + this.Byte.Equals(input.Byte)) + ) && + ( + this.Binary == input.Binary || + (this.Binary != null && + this.Binary.Equals(input.Binary)) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.DateTime == input.DateTime || + (this.DateTime != null && + this.DateTime.Equals(input.DateTime)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ) && + ( + this.Callback == input.Callback || + (this.Callback != null && + this.Callback.Equals(input.Callback)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Integer != null) + hashCode = hashCode * 59 + this.Integer.GetHashCode(); + if (this.Int32 != null) + hashCode = hashCode * 59 + this.Int32.GetHashCode(); + if (this.Int64 != null) + hashCode = hashCode * 59 + this.Int64.GetHashCode(); + if (this.Number != null) + hashCode = hashCode * 59 + this.Number.GetHashCode(); + if (this.Float != null) + hashCode = hashCode * 59 + this.Float.GetHashCode(); + if (this.Double != null) + hashCode = hashCode * 59 + this.Double.GetHashCode(); + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + if (this.PatternWithoutDelimiter != null) + hashCode = hashCode * 59 + this.PatternWithoutDelimiter.GetHashCode(); + if (this.Byte != null) + hashCode = hashCode * 59 + this.Byte.GetHashCode(); + if (this.Binary != null) + hashCode = hashCode * 59 + this.Binary.GetHashCode(); + if (this.Date != null) + hashCode = hashCode * 59 + this.Date.GetHashCode(); + if (this.DateTime != null) + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + if (this.Callback != null) + hashCode = hashCode * 59 + this.Callback.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject4.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject4.cs new file mode 100644 index 00000000000..7ad988b55f8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject4.cs @@ -0,0 +1,151 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject4 + /// + [DataContract] + public partial class InlineObject4 : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject4() { } + /// + /// Initializes a new instance of the class. + /// + /// field1 (required). + /// field2 (required). + public InlineObject4(string param = default(string), string param2 = default(string)) + { + // to ensure "param" is required (not null) + if (param == null) + { + throw new InvalidDataException("param is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param = param; + } + // to ensure "param2" is required (not null) + if (param2 == null) + { + throw new InvalidDataException("param2 is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param2 = param2; + } + } + + /// + /// field1 + /// + /// field1 + [DataMember(Name="param", EmitDefaultValue=false)] + public string Param { get; set; } + + /// + /// field2 + /// + /// field2 + [DataMember(Name="param2", EmitDefaultValue=false)] + public string Param2 { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject4 {\n"); + sb.Append(" Param: ").Append(Param).Append("\n"); + sb.Append(" Param2: ").Append(Param2).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject4); + } + + /// + /// Returns true if InlineObject4 instances are equal + /// + /// Instance of InlineObject4 to be compared + /// Boolean + public bool Equals(InlineObject4 input) + { + if (input == null) + return false; + + return + ( + this.Param == input.Param || + (this.Param != null && + this.Param.Equals(input.Param)) + ) && + ( + this.Param2 == input.Param2 || + (this.Param2 != null && + this.Param2.Equals(input.Param2)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Param != null) + hashCode = hashCode * 59 + this.Param.GetHashCode(); + if (this.Param2 != null) + hashCode = hashCode * 59 + this.Param2.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject5.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject5.cs new file mode 100644 index 00000000000..e80e5b733af --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineObject5.cs @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject5 + /// + [DataContract] + public partial class InlineObject5 : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject5() { } + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload (required). + public InlineObject5(string additionalMetadata = default(string), System.IO.Stream requiredFile = default(System.IO.Stream)) + { + // to ensure "requiredFile" is required (not null) + if (requiredFile == null) + { + throw new InvalidDataException("requiredFile is a required property for InlineObject5 and cannot be null"); + } + else + { + this.RequiredFile = requiredFile; + } + this.AdditionalMetadata = additionalMetadata; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="requiredFile", EmitDefaultValue=false)] + public System.IO.Stream RequiredFile { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject5 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" RequiredFile: ").Append(RequiredFile).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject5); + } + + /// + /// Returns true if InlineObject5 instances are equal + /// + /// Instance of InlineObject5 to be compared + /// Boolean + public bool Equals(InlineObject5 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.RequiredFile == input.RequiredFile || + (this.RequiredFile != null && + this.RequiredFile.Equals(input.RequiredFile)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.RequiredFile != null) + hashCode = hashCode * 59 + this.RequiredFile.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineResponseDefault.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineResponseDefault.cs new file mode 100644 index 00000000000..42a0feba4c4 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/InlineResponseDefault.cs @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineResponseDefault + /// + [DataContract] + public partial class InlineResponseDefault : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public InlineResponseDefault(Foo _string = default(Foo)) + { + this.String = _string; + } + + /// + /// Gets or Sets String + /// + [DataMember(Name="string", EmitDefaultValue=false)] + public Foo String { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineResponseDefault {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineResponseDefault); + } + + /// + /// Returns true if InlineResponseDefault instances are equal + /// + /// Instance of InlineResponseDefault to be compared + /// Boolean + public bool Equals(InlineResponseDefault input) + { + if (input == null) + return false; + + return + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs index 18ccbc3ba9b..8a85cf487f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs @@ -61,7 +61,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -86,7 +86,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -151,8 +151,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Category.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/DefaultApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/DefaultApi.md new file mode 100644 index 00000000000..92f2dc125c0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/DefaultApi.md @@ -0,0 +1,63 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FooGet**](DefaultApi.md#fooget) | **GET** /foo | + + + +# **FooGet** +> InlineResponseDefault FooGet () + + + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public void main() + { + var apiInstance = new DefaultApi(); + + try + { + InlineResponseDefault result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Foo.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Foo.md new file mode 100644 index 00000000000..fd84dc2038c --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/Foo.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.Foo +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject.md new file mode 100644 index 00000000000..40e16da1bb7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Updated name of the pet | [optional] +**Status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject1.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject1.md new file mode 100644 index 00000000000..2e6d226754e --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject1.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject1 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**File** | **System.IO.Stream** | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject2.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject2.md new file mode 100644 index 00000000000..c02c78f9b2d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject2.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject2 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumFormStringArray** | **List<string>** | Form parameter enum test (string array) | [optional] +**EnumFormString** | **string** | Form parameter enum test (string) | [optional] [default to EnumFormStringEnum.Efg] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject3.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject3.md new file mode 100644 index 00000000000..192926bbe92 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject3.md @@ -0,0 +1,22 @@ +# Org.OpenAPITools.Model.InlineObject3 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int?** | None | [optional] +**Int32** | **int?** | None | [optional] +**Int64** | **long?** | None | [optional] +**Number** | **decimal?** | None | +**Float** | **float?** | None | [optional] +**Double** | **double?** | None | +**String** | **string** | None | [optional] +**PatternWithoutDelimiter** | **string** | None | +**Byte** | **byte[]** | None | +**Binary** | **System.IO.Stream** | None | [optional] +**Date** | **DateTime?** | None | [optional] +**DateTime** | **DateTime?** | None | [optional] +**Password** | **string** | None | [optional] +**Callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject4.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject4.md new file mode 100644 index 00000000000..c8e00663ee8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject4.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject4 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Param** | **string** | field1 | +**Param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject5.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject5.md new file mode 100644 index 00000000000..a28ff47f2ec --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineObject5.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject5 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**RequiredFile** | **System.IO.Stream** | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineResponseDefault.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineResponseDefault.md new file mode 100644 index 00000000000..8c96fb62ac8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/InlineResponseDefault.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.InlineResponseDefault +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 00000000000..62f61182996 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using NUnit.Framework; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing DefaultApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + [TestFixture] + public class DefaultApiTests + { + private DefaultApi instance; + + /// + /// Setup before each unit test + /// + [SetUp] + public void Init() + { + instance = new DefaultApi(); + } + + /// + /// Clean up after each unit test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of DefaultApi + /// + [Test] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' DefaultApi + //Assert.IsInstanceOfType(typeof(DefaultApi), instance, "instance is a DefaultApi"); + } + + + /// + /// Test FooGet + /// + [Test] + public void FooGetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.FooGet(); + //Assert.IsInstanceOf (response, "response is InlineResponseDefault"); + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 00000000000..eedf488e508 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FooTests + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Foo + /// + [Test] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Foo + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Foo"); + } + + + /// + /// Test the property 'Bar' + /// + [Test] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs new file mode 100644 index 00000000000..135ba44d806 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject1 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject1Tests + { + // TODO uncomment below to declare an instance variable for InlineObject1 + //private InlineObject1 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject1 + //instance = new InlineObject1(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject1 + /// + [Test] + public void InlineObject1InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject1 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject1"); + } + + + /// + /// Test the property 'AdditionalMetadata' + /// + [Test] + public void AdditionalMetadataTest() + { + // TODO unit test for the property 'AdditionalMetadata' + } + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs new file mode 100644 index 00000000000..7c48afda606 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject2 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject2Tests + { + // TODO uncomment below to declare an instance variable for InlineObject2 + //private InlineObject2 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject2 + //instance = new InlineObject2(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject2 + /// + [Test] + public void InlineObject2InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject2 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject2"); + } + + + /// + /// Test the property 'EnumFormStringArray' + /// + [Test] + public void EnumFormStringArrayTest() + { + // TODO unit test for the property 'EnumFormStringArray' + } + /// + /// Test the property 'EnumFormString' + /// + [Test] + public void EnumFormStringTest() + { + // TODO unit test for the property 'EnumFormString' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs new file mode 100644 index 00000000000..fc9f4130303 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs @@ -0,0 +1,184 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject3 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject3Tests + { + // TODO uncomment below to declare an instance variable for InlineObject3 + //private InlineObject3 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject3 + //instance = new InlineObject3(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject3 + /// + [Test] + public void InlineObject3InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject3 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject3"); + } + + + /// + /// Test the property 'Integer' + /// + [Test] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + /// + /// Test the property 'Int32' + /// + [Test] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + /// + /// Test the property 'Int64' + /// + [Test] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + /// + /// Test the property 'Number' + /// + [Test] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + /// + /// Test the property 'Float' + /// + [Test] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + /// + /// Test the property 'Double' + /// + [Test] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + /// + /// Test the property 'String' + /// + [Test] + public void StringTest() + { + // TODO unit test for the property 'String' + } + /// + /// Test the property 'PatternWithoutDelimiter' + /// + [Test] + public void PatternWithoutDelimiterTest() + { + // TODO unit test for the property 'PatternWithoutDelimiter' + } + /// + /// Test the property 'Byte' + /// + [Test] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + /// + /// Test the property 'Binary' + /// + [Test] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// + /// Test the property 'Date' + /// + [Test] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + /// + /// Test the property 'DateTime' + /// + [Test] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + /// + /// Test the property 'Password' + /// + [Test] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// + /// Test the property 'Callback' + /// + [Test] + public void CallbackTest() + { + // TODO unit test for the property 'Callback' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs new file mode 100644 index 00000000000..9cbda37320b --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject4 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject4Tests + { + // TODO uncomment below to declare an instance variable for InlineObject4 + //private InlineObject4 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject4 + //instance = new InlineObject4(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject4 + /// + [Test] + public void InlineObject4InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject4 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject4"); + } + + + /// + /// Test the property 'Param' + /// + [Test] + public void ParamTest() + { + // TODO unit test for the property 'Param' + } + /// + /// Test the property 'Param2' + /// + [Test] + public void Param2Test() + { + // TODO unit test for the property 'Param2' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs new file mode 100644 index 00000000000..5a4a9d1e811 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject5 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject5Tests + { + // TODO uncomment below to declare an instance variable for InlineObject5 + //private InlineObject5 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject5 + //instance = new InlineObject5(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject5 + /// + [Test] + public void InlineObject5InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject5 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject5"); + } + + + /// + /// Test the property 'AdditionalMetadata' + /// + [Test] + public void AdditionalMetadataTest() + { + // TODO unit test for the property 'AdditionalMetadata' + } + /// + /// Test the property 'RequiredFile' + /// + [Test] + public void RequiredFileTest() + { + // TODO unit test for the property 'RequiredFile' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs new file mode 100644 index 00000000000..816174fe3b9 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObjectTests + { + // TODO uncomment below to declare an instance variable for InlineObject + //private InlineObject instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject + //instance = new InlineObject(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject + /// + [Test] + public void InlineObjectInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject"); + } + + + /// + /// Test the property 'Name' + /// + [Test] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + /// + /// Test the property 'Status' + /// + [Test] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs new file mode 100644 index 00000000000..01b28899823 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineResponseDefault + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineResponseDefaultTests + { + // TODO uncomment below to declare an instance variable for InlineResponseDefault + //private InlineResponseDefault instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineResponseDefault + //instance = new InlineResponseDefault(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineResponseDefault + /// + [Test] + public void InlineResponseDefaultInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineResponseDefault + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineResponseDefault"); + } + + + /// + /// Test the property 'String' + /// + [Test] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 00000000000..715dba60323 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,289 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + InlineResponseDefault FooGet (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + ApiResponse FooGetWithHttpInfo (); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + System.Threading.Tasks.Task FooGetAsync (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo (); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(String basePath) + { + this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath }; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public IDictionary DefaultHeader() + { + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + public InlineResponseDefault FooGet () + { + ApiResponse localVarResponse = FooGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + public ApiResponse< InlineResponseDefault > FooGetWithHttpInfo () + { + + var localVarPath = "/foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + public async System.Threading.Tasks.Task FooGetAsync () + { + ApiResponse localVarResponse = await FooGetAsyncWithHttpInfo(); + return localVarResponse.Data; + + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + public async System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo () + { + + var localVarPath = "/foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Cat.cs index 4b9a7e5a590..ea9ef6d75cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Cat.cs @@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Category.cs index 59f0f0080a3..1e910675825 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Category.cs @@ -33,15 +33,28 @@ namespace Org.OpenAPITools.Model [ImplementPropertyChanged] public partial class Category : IEquatable, IValidatableObject { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Dog.cs index 678a3a48e22..6e10198b042 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Dog.cs @@ -146,7 +146,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 00000000000..c82a275a59b --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Foo.cs @@ -0,0 +1,155 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + [DataContract] + [ImplementPropertyChanged] + public partial class Foo : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar"). + public Foo(string bar = "bar") + { + // use default value if no "bar" provided + if (bar == null) + { + this.Bar = "bar"; + } + else + { + this.Bar = bar; + } + } + + /// + /// Gets or Sets Bar + /// + [DataMember(Name="bar", EmitDefaultValue=false)] + public string Bar { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Foo); + } + + /// + /// Returns true if Foo instances are equal + /// + /// Instance of Foo to be compared + /// Boolean + public bool Equals(Foo input) + { + if (input == null) + return false; + + return + ( + this.Bar == input.Bar || + (this.Bar != null && + this.Bar.Equals(input.Bar)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Bar != null) + hashCode = hashCode * 59 + this.Bar.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject.cs new file mode 100644 index 00000000000..4dae13e897f --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject.cs @@ -0,0 +1,165 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Updated name of the pet. + /// Updated status of the pet. + public InlineObject(string name = default(string), string status = default(string)) + { + this.Name = name; + this.Status = status; + } + + /// + /// Updated name of the pet + /// + /// Updated name of the pet + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Updated status of the pet + /// + /// Updated status of the pet + [DataMember(Name="status", EmitDefaultValue=false)] + public string Status { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject); + } + + /// + /// Returns true if InlineObject instances are equal + /// + /// Instance of InlineObject to be compared + /// Boolean + public bool Equals(InlineObject input) + { + if (input == null) + return false; + + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.Status != null) + hashCode = hashCode * 59 + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject1.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject1.cs new file mode 100644 index 00000000000..073d6102999 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject1.cs @@ -0,0 +1,165 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject1 + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject1 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload. + public InlineObject1(string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)) + { + this.AdditionalMetadata = additionalMetadata; + this.File = file; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject1 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject1); + } + + /// + /// Returns true if InlineObject1 instances are equal + /// + /// Instance of InlineObject1 to be compared + /// Boolean + public bool Equals(InlineObject1 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject2.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject2.cs new file mode 100644 index 00000000000..e10d573f9e1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject2.cs @@ -0,0 +1,221 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject2 + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject2 : IEquatable, IValidatableObject + { + /// + /// Defines EnumFormStringArray + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringArrayEnum + { + /// + /// Enum GreaterThan for value: > + /// + [EnumMember(Value = ">")] + GreaterThan = 1, + + /// + /// Enum Dollar for value: $ + /// + [EnumMember(Value = "$")] + Dollar = 2 + + } + + + /// + /// Form parameter enum test (string array) + /// + /// Form parameter enum test (string array) + [DataMember(Name="enum_form_string_array", EmitDefaultValue=false)] + public List EnumFormStringArray { get; set; } + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringEnum + { + /// + /// Enum Abc for value: _abc + /// + [EnumMember(Value = "_abc")] + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + [EnumMember(Value = "-efg")] + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + [EnumMember(Value = "(xyz)")] + Xyz = 3 + + } + + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [DataMember(Name="enum_form_string", EmitDefaultValue=false)] + public EnumFormStringEnum? EnumFormString { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Form parameter enum test (string array). + /// Form parameter enum test (string) (default to EnumFormStringEnum.Efg). + public InlineObject2(List enumFormStringArray = default(List), EnumFormStringEnum? enumFormString = EnumFormStringEnum.Efg) + { + this.EnumFormStringArray = enumFormStringArray; + // use default value if no "enumFormString" provided + if (enumFormString == null) + { + this.EnumFormString = EnumFormStringEnum.Efg; + } + else + { + this.EnumFormString = enumFormString; + } + } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject2 {\n"); + sb.Append(" EnumFormStringArray: ").Append(EnumFormStringArray).Append("\n"); + sb.Append(" EnumFormString: ").Append(EnumFormString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject2); + } + + /// + /// Returns true if InlineObject2 instances are equal + /// + /// Instance of InlineObject2 to be compared + /// Boolean + public bool Equals(InlineObject2 input) + { + if (input == null) + return false; + + return + ( + this.EnumFormStringArray == input.EnumFormStringArray || + this.EnumFormStringArray != null && + this.EnumFormStringArray.SequenceEqual(input.EnumFormStringArray) + ) && + ( + this.EnumFormString == input.EnumFormString || + (this.EnumFormString != null && + this.EnumFormString.Equals(input.EnumFormString)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EnumFormStringArray != null) + hashCode = hashCode * 59 + this.EnumFormStringArray.GetHashCode(); + if (this.EnumFormString != null) + hashCode = hashCode * 59 + this.EnumFormString.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject3.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject3.cs new file mode 100644 index 00000000000..aa6cdeac31b --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject3.cs @@ -0,0 +1,487 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject3 + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject3 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject3() { } + /// + /// Initializes a new instance of the class. + /// + /// None. + /// None. + /// None. + /// None (required). + /// None. + /// None (required). + /// None. + /// None (required). + /// None (required). + /// None. + /// None. + /// None. + /// None. + /// None. + public InlineObject3(int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), decimal? number = default(decimal?), float? _float = default(float?), double? _double = default(double?), string _string = default(string), string patternWithoutDelimiter = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) + { + // to ensure "number" is required (not null) + if (number == null) + { + throw new InvalidDataException("number is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Number = number; + } + // to ensure "_double" is required (not null) + if (_double == null) + { + throw new InvalidDataException("_double is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Double = _double; + } + // to ensure "patternWithoutDelimiter" is required (not null) + if (patternWithoutDelimiter == null) + { + throw new InvalidDataException("patternWithoutDelimiter is a required property for InlineObject3 and cannot be null"); + } + else + { + this.PatternWithoutDelimiter = patternWithoutDelimiter; + } + // to ensure "_byte" is required (not null) + if (_byte == null) + { + throw new InvalidDataException("_byte is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Byte = _byte; + } + this.Integer = integer; + this.Int32 = int32; + this.Int64 = int64; + this.Float = _float; + this.String = _string; + this.Binary = binary; + this.Date = date; + this.DateTime = dateTime; + this.Password = password; + this.Callback = callback; + } + + /// + /// None + /// + /// None + [DataMember(Name="integer", EmitDefaultValue=false)] + public int? Integer { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int32", EmitDefaultValue=false)] + public int? Int32 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int64", EmitDefaultValue=false)] + public long? Int64 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="number", EmitDefaultValue=false)] + public decimal? Number { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="float", EmitDefaultValue=false)] + public float? Float { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="double", EmitDefaultValue=false)] + public double? Double { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="string", EmitDefaultValue=false)] + public string String { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="pattern_without_delimiter", EmitDefaultValue=false)] + public string PatternWithoutDelimiter { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="byte", EmitDefaultValue=false)] + public byte[] Byte { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="binary", EmitDefaultValue=false)] + public System.IO.Stream Binary { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="date", EmitDefaultValue=false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? Date { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="dateTime", EmitDefaultValue=false)] + public DateTime? DateTime { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="callback", EmitDefaultValue=false)] + public string Callback { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject3 {\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" PatternWithoutDelimiter: ").Append(PatternWithoutDelimiter).Append("\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Callback: ").Append(Callback).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject3); + } + + /// + /// Returns true if InlineObject3 instances are equal + /// + /// Instance of InlineObject3 to be compared + /// Boolean + public bool Equals(InlineObject3 input) + { + if (input == null) + return false; + + return + ( + this.Integer == input.Integer || + (this.Integer != null && + this.Integer.Equals(input.Integer)) + ) && + ( + this.Int32 == input.Int32 || + (this.Int32 != null && + this.Int32.Equals(input.Int32)) + ) && + ( + this.Int64 == input.Int64 || + (this.Int64 != null && + this.Int64.Equals(input.Int64)) + ) && + ( + this.Number == input.Number || + (this.Number != null && + this.Number.Equals(input.Number)) + ) && + ( + this.Float == input.Float || + (this.Float != null && + this.Float.Equals(input.Float)) + ) && + ( + this.Double == input.Double || + (this.Double != null && + this.Double.Equals(input.Double)) + ) && + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ) && + ( + this.PatternWithoutDelimiter == input.PatternWithoutDelimiter || + (this.PatternWithoutDelimiter != null && + this.PatternWithoutDelimiter.Equals(input.PatternWithoutDelimiter)) + ) && + ( + this.Byte == input.Byte || + (this.Byte != null && + this.Byte.Equals(input.Byte)) + ) && + ( + this.Binary == input.Binary || + (this.Binary != null && + this.Binary.Equals(input.Binary)) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.DateTime == input.DateTime || + (this.DateTime != null && + this.DateTime.Equals(input.DateTime)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ) && + ( + this.Callback == input.Callback || + (this.Callback != null && + this.Callback.Equals(input.Callback)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Integer != null) + hashCode = hashCode * 59 + this.Integer.GetHashCode(); + if (this.Int32 != null) + hashCode = hashCode * 59 + this.Int32.GetHashCode(); + if (this.Int64 != null) + hashCode = hashCode * 59 + this.Int64.GetHashCode(); + if (this.Number != null) + hashCode = hashCode * 59 + this.Number.GetHashCode(); + if (this.Float != null) + hashCode = hashCode * 59 + this.Float.GetHashCode(); + if (this.Double != null) + hashCode = hashCode * 59 + this.Double.GetHashCode(); + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + if (this.PatternWithoutDelimiter != null) + hashCode = hashCode * 59 + this.PatternWithoutDelimiter.GetHashCode(); + if (this.Byte != null) + hashCode = hashCode * 59 + this.Byte.GetHashCode(); + if (this.Binary != null) + hashCode = hashCode * 59 + this.Binary.GetHashCode(); + if (this.Date != null) + hashCode = hashCode * 59 + this.Date.GetHashCode(); + if (this.DateTime != null) + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + if (this.Callback != null) + hashCode = hashCode * 59 + this.Callback.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Integer (int?) maximum + if(this.Integer > (int?)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int?) minimum + if(this.Integer < (int?)10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + // Int32 (int?) maximum + if(this.Int32 > (int?)200) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int?) minimum + if(this.Int32 < (int?)20) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Number (decimal?) maximum + if(this.Number > (decimal?)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal?) minimum + if(this.Number < (decimal?)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Float (float?) maximum + if(this.Float > (float?)987.6) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Double (double?) maximum + if(this.Double > (double?)123.4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double?) minimum + if(this.Double < (double?)67.8) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (false == regexString.Match(this.String).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + + // PatternWithoutDelimiter (string) pattern + Regex regexPatternWithoutDelimiter = new Regex(@"^[A-Z].*", RegexOptions.CultureInvariant); + if (false == regexPatternWithoutDelimiter.Match(this.PatternWithoutDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithoutDelimiter, must match a pattern of " + regexPatternWithoutDelimiter, new [] { "PatternWithoutDelimiter" }); + } + + // Password (string) maxLength + if(this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if(this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject4.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject4.cs new file mode 100644 index 00000000000..6d19e0c9ede --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject4.cs @@ -0,0 +1,186 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject4 + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject4 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject4() { } + /// + /// Initializes a new instance of the class. + /// + /// field1 (required). + /// field2 (required). + public InlineObject4(string param = default(string), string param2 = default(string)) + { + // to ensure "param" is required (not null) + if (param == null) + { + throw new InvalidDataException("param is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param = param; + } + // to ensure "param2" is required (not null) + if (param2 == null) + { + throw new InvalidDataException("param2 is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param2 = param2; + } + } + + /// + /// field1 + /// + /// field1 + [DataMember(Name="param", EmitDefaultValue=false)] + public string Param { get; set; } + + /// + /// field2 + /// + /// field2 + [DataMember(Name="param2", EmitDefaultValue=false)] + public string Param2 { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject4 {\n"); + sb.Append(" Param: ").Append(Param).Append("\n"); + sb.Append(" Param2: ").Append(Param2).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject4); + } + + /// + /// Returns true if InlineObject4 instances are equal + /// + /// Instance of InlineObject4 to be compared + /// Boolean + public bool Equals(InlineObject4 input) + { + if (input == null) + return false; + + return + ( + this.Param == input.Param || + (this.Param != null && + this.Param.Equals(input.Param)) + ) && + ( + this.Param2 == input.Param2 || + (this.Param2 != null && + this.Param2.Equals(input.Param2)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Param != null) + hashCode = hashCode * 59 + this.Param.GetHashCode(); + if (this.Param2 != null) + hashCode = hashCode * 59 + this.Param2.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject5.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject5.cs new file mode 100644 index 00000000000..45346f6e4c7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineObject5.cs @@ -0,0 +1,178 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject5 + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineObject5 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject5() { } + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload (required). + public InlineObject5(string additionalMetadata = default(string), System.IO.Stream requiredFile = default(System.IO.Stream)) + { + // to ensure "requiredFile" is required (not null) + if (requiredFile == null) + { + throw new InvalidDataException("requiredFile is a required property for InlineObject5 and cannot be null"); + } + else + { + this.RequiredFile = requiredFile; + } + this.AdditionalMetadata = additionalMetadata; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="requiredFile", EmitDefaultValue=false)] + public System.IO.Stream RequiredFile { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject5 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" RequiredFile: ").Append(RequiredFile).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject5); + } + + /// + /// Returns true if InlineObject5 instances are equal + /// + /// Instance of InlineObject5 to be compared + /// Boolean + public bool Equals(InlineObject5 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.RequiredFile == input.RequiredFile || + (this.RequiredFile != null && + this.RequiredFile.Equals(input.RequiredFile)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.RequiredFile != null) + hashCode = hashCode * 59 + this.RequiredFile.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineResponseDefault.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineResponseDefault.cs new file mode 100644 index 00000000000..39cff5c0cb1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/InlineResponseDefault.cs @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineResponseDefault + /// + [DataContract] + [ImplementPropertyChanged] + public partial class InlineResponseDefault : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public InlineResponseDefault(Foo _string = default(Foo)) + { + this.String = _string; + } + + /// + /// Gets or Sets String + /// + [DataMember(Name="string", EmitDefaultValue=false)] + public Foo String { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineResponseDefault {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineResponseDefault); + } + + /// + /// Returns true if InlineResponseDefault instances are equal + /// + /// Instance of InlineResponseDefault to be compared + /// Boolean + public bool Equals(InlineResponseDefault input) + { + if (input == null) + return false; + + return + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs index ddaac33ee49..c1faecd1f20 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs @@ -66,7 +66,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -156,8 +156,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index 4009731809f..debb8e0c844 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -1033,14 +1033,17 @@ components: schemas: Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1525,7 +1528,7 @@ components: name: doggie id: 0 category: - name: name + name: default-name id: 6 tags: - name: name diff --git a/samples/client/petstore/go/go-petstore/docs/Category.md b/samples/client/petstore/go/go-petstore/docs/Category.md index a0f5c8446a5..1440215d225 100644 --- a/samples/client/petstore/go/go-petstore/docs/Category.md +++ b/samples/client/petstore/go/go-petstore/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to default-name] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/model_category.go b/samples/client/petstore/go/go-petstore/model_category.go index e0e9479465e..2f971417ac1 100644 --- a/samples/client/petstore/go/go-petstore/model_category.go +++ b/samples/client/petstore/go/go-petstore/model_category.go @@ -11,5 +11,5 @@ package petstore type Category struct { Id int64 `json:"id,omitempty"` - Name string `json:"name,omitempty"` + Name string `json:"name"` } diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs index dcbcef0b83f..cf1093c0640 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -505,7 +505,7 @@ mkCat catClassName = -- | Category data Category = Category { categoryId :: !(Maybe Integer) -- ^ "id" - , categoryName :: !(Maybe Text) -- ^ "name" + , categoryName :: !(Text) -- ^ /Required/ "name" } deriving (P.Show, P.Eq, P.Typeable) -- | FromJSON Category @@ -513,7 +513,7 @@ instance A.FromJSON Category where parseJSON = A.withObject "Category" $ \o -> Category <$> (o .:? "id") - <*> (o .:? "name") + <*> (o .: "name") -- | ToJSON Category instance A.ToJSON Category where @@ -526,11 +526,12 @@ instance A.ToJSON Category where -- | Construct a value of type 'Category' (by applying it's required fields, if any) mkCategory - :: Category -mkCategory = + :: Text -- ^ 'categoryName' + -> Category +mkCategory categoryName = Category { categoryId = Nothing - , categoryName = Nothing + , categoryName } -- ** ClassModel diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs index a093ca73ca0..b1aa4c791c5 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs @@ -185,7 +185,7 @@ categoryIdL f Category{..} = (\categoryId -> Category { categoryId, ..} ) <$> f {-# INLINE categoryIdL #-} -- | 'categoryName' Lens -categoryNameL :: Lens_' Category (Maybe Text) +categoryNameL :: Lens_' Category (Text) categoryNameL f Category{..} = (\categoryName -> Category { categoryName, ..} ) <$> f categoryName {-# INLINE categoryNameL #-} diff --git a/samples/client/petstore/haskell-http-client/openapi.yaml b/samples/client/petstore/haskell-http-client/openapi.yaml index 4009731809f..debb8e0c844 100644 --- a/samples/client/petstore/haskell-http-client/openapi.yaml +++ b/samples/client/petstore/haskell-http-client/openapi.yaml @@ -1033,14 +1033,17 @@ components: schemas: Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1525,7 +1528,7 @@ components: name: doggie id: 0 category: - name: name + name: default-name id: 6 tags: - name: name diff --git a/samples/client/petstore/haskell-http-client/tests/Instances.hs b/samples/client/petstore/haskell-http-client/tests/Instances.hs index dc1a79b93dd..59f575e12cd 100644 --- a/samples/client/petstore/haskell-http-client/tests/Instances.hs +++ b/samples/client/petstore/haskell-http-client/tests/Instances.hs @@ -151,7 +151,7 @@ instance Arbitrary Category where arbitrary = Category <$> arbitrary -- categoryId :: Maybe Integer - <*> arbitrary -- categoryName :: Maybe Text + <*> arbitrary -- categoryName :: Text instance Arbitrary ClassModel where arbitrary = diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/google-api-client/docs/Category.md b/samples/client/petstore/java/google-api-client/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/google-api-client/docs/Category.md +++ b/samples/client/petstore/java/google-api-client/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey1/docs/Category.md b/samples/client/petstore/java/jersey1/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/jersey1/docs/Category.md +++ b/samples/client/petstore/java/jersey1/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey2-java6/docs/Category.md b/samples/client/petstore/java/jersey2-java6/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/Category.md +++ b/samples/client/petstore/java/jersey2-java6/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java index a8efb73047b..383fc00a802 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java @@ -29,7 +29,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -58,7 +58,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey2-java8/docs/Category.md b/samples/client/petstore/java/jersey2-java8/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/Category.md +++ b/samples/client/petstore/java/jersey2-java8/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey2/docs/Category.md b/samples/client/petstore/java/jersey2/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/jersey2/docs/Category.md +++ b/samples/client/petstore/java/jersey2/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index b8127d81106..85b75bb96e1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -37,7 +37,7 @@ public class Category implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category() { } @@ -68,7 +68,7 @@ public class Category implements Parcelable { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/okhttp-gson/docs/Category.md b/samples/client/petstore/java/okhttp-gson/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/Category.md +++ b/samples/client/petstore/java/okhttp-gson/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/rest-assured/docs/Category.md b/samples/client/petstore/java/rest-assured/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/rest-assured/docs/Category.md +++ b/samples/client/petstore/java/rest-assured/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/resteasy/docs/Category.md b/samples/client/petstore/java/resteasy/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/resteasy/docs/Category.md +++ b/samples/client/petstore/java/resteasy/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/Category.md b/samples/client/petstore/java/resttemplate-withXml/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/Category.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java index e1941529f4b..ccd4a3d349c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java @@ -39,7 +39,7 @@ public class Category { @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -68,7 +68,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/resttemplate/docs/Category.md b/samples/client/petstore/java/resttemplate/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/resttemplate/docs/Category.md +++ b/samples/client/petstore/java/resttemplate/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2-play24/docs/Category.md b/samples/client/petstore/java/retrofit2-play24/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/Category.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java index 07563857e8b..263805edafb 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java @@ -32,7 +32,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -61,7 +61,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @NotNull + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2-play25/docs/Category.md b/samples/client/petstore/java/retrofit2-play25/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/Category.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java index 07563857e8b..263805edafb 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java @@ -32,7 +32,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -61,7 +61,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @NotNull + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Category.md b/samples/client/petstore/java/retrofit2-play26/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/Category.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java index 07563857e8b..263805edafb 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java @@ -32,7 +32,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -61,7 +61,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @NotNull + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2/docs/Category.md b/samples/client/petstore/java/retrofit2/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2/docs/Category.md +++ b/samples/client/petstore/java/retrofit2/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2rx/docs/Category.md b/samples/client/petstore/java/retrofit2rx/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/Category.md +++ b/samples/client/petstore/java/retrofit2rx/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/retrofit2rx2/docs/Category.md b/samples/client/petstore/java/retrofit2rx2/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/Category.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java index 68177b01908..433f1912739 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java @@ -35,7 +35,7 @@ public class Category { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -64,7 +64,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/vertx/docs/Category.md b/samples/client/petstore/java/vertx/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/vertx/docs/Category.md +++ b/samples/client/petstore/java/vertx/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/webclient/docs/Category.md b/samples/client/petstore/java/webclient/docs/Category.md index e2df0803278..a65070423ff 100644 --- a/samples/client/petstore/java/webclient/docs/Category.md +++ b/samples/client/petstore/java/webclient/docs/Category.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Long** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java index ffc9482ffc0..83293041e0e 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -59,7 +59,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md index 80aef312e5e..369f811a4eb 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**name** | **string** | | [optional] +**name** | **string** | | [default to 'default-name'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php index 2932a5b7614..d810bd91fc8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php @@ -183,7 +183,7 @@ class Category implements ModelInterface, ArrayAccess public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : 'default-name'; } /** @@ -195,6 +195,9 @@ class Category implements ModelInterface, ArrayAccess { $invalidProperties = []; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } return $invalidProperties; } @@ -237,7 +240,7 @@ class Category implements ModelInterface, ArrayAccess /** * Gets name * - * @return string|null + * @return string */ public function getName() { @@ -247,7 +250,7 @@ class Category implements ModelInterface, ArrayAccess /** * Sets name * - * @param string|null $name name + * @param string $name name * * @return $this */ diff --git a/samples/client/petstore/ruby/docs/Category.md b/samples/client/petstore/ruby/docs/Category.md index f642a3d6b86..4500de105b2 100644 --- a/samples/client/petstore/ruby/docs/Category.md +++ b/samples/client/petstore/ruby/docs/Category.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Integer** | | [optional] -**name** | **String** | | [optional] +**name** | **String** | | [default to 'default-name'] diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index 6e7b0bdf1ea..3d5834c13a0 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -48,6 +48,8 @@ module Petstore if attributes.has_key?(:'name') self.name = attributes[:'name'] + else + self.name = 'default-name' end end @@ -55,12 +57,17 @@ module Petstore # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return false if @name.nil? true end diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/.openapi-generator/VERSION b/samples/openapi3/client/petstore/csharp/OpenAPIClient/.openapi-generator/VERSION index 14900cee60e..a6527129083 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/README.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/README.md index a2b8a9b17a0..94a6f65acb2 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/README.md @@ -97,6 +97,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo | *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -152,8 +153,16 @@ Class | Method | HTTP request | Description - [Model.EnumTest](docs/EnumTest.md) - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Model.Foo](docs/Foo.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [Model.InlineObject](docs/InlineObject.md) + - [Model.InlineObject1](docs/InlineObject1.md) + - [Model.InlineObject2](docs/InlineObject2.md) + - [Model.InlineObject3](docs/InlineObject3.md) + - [Model.InlineObject4](docs/InlineObject4.md) + - [Model.InlineObject5](docs/InlineObject5.md) + - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.List](docs/List.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Category.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Category.md index 860a468e35c..67e28fe8d08 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Category.md +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **long?** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md new file mode 100644 index 00000000000..92f2dc125c0 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md @@ -0,0 +1,63 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FooGet**](DefaultApi.md#fooget) | **GET** /foo | + + + +# **FooGet** +> InlineResponseDefault FooGet () + + + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public void main() + { + var apiInstance = new DefaultApi(); + + try + { + InlineResponseDefault result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Foo.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Foo.md new file mode 100644 index 00000000000..fd84dc2038c --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/Foo.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.Foo +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject.md new file mode 100644 index 00000000000..40e16da1bb7 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Updated name of the pet | [optional] +**Status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject1.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject1.md new file mode 100644 index 00000000000..2e6d226754e --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject1.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject1 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**File** | **System.IO.Stream** | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject2.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject2.md new file mode 100644 index 00000000000..c02c78f9b2d --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject2.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject2 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumFormStringArray** | **List<string>** | Form parameter enum test (string array) | [optional] +**EnumFormString** | **string** | Form parameter enum test (string) | [optional] [default to EnumFormStringEnum.Efg] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject3.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject3.md new file mode 100644 index 00000000000..192926bbe92 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject3.md @@ -0,0 +1,22 @@ +# Org.OpenAPITools.Model.InlineObject3 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int?** | None | [optional] +**Int32** | **int?** | None | [optional] +**Int64** | **long?** | None | [optional] +**Number** | **decimal?** | None | +**Float** | **float?** | None | [optional] +**Double** | **double?** | None | +**String** | **string** | None | [optional] +**PatternWithoutDelimiter** | **string** | None | +**Byte** | **byte[]** | None | +**Binary** | **System.IO.Stream** | None | [optional] +**Date** | **DateTime?** | None | [optional] +**DateTime** | **DateTime?** | None | [optional] +**Password** | **string** | None | [optional] +**Callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject4.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject4.md new file mode 100644 index 00000000000..c8e00663ee8 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject4.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject4 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Param** | **string** | field1 | +**Param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject5.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject5.md new file mode 100644 index 00000000000..a28ff47f2ec --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineObject5.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.InlineObject5 +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**RequiredFile** | **System.IO.Stream** | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineResponseDefault.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineResponseDefault.md new file mode 100644 index 00000000000..8c96fb62ac8 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/InlineResponseDefault.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.InlineResponseDefault +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/MapTest.md b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/MapTest.md +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 00000000000..62f61182996 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using NUnit.Framework; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing DefaultApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + [TestFixture] + public class DefaultApiTests + { + private DefaultApi instance; + + /// + /// Setup before each unit test + /// + [SetUp] + public void Init() + { + instance = new DefaultApi(); + } + + /// + /// Clean up after each unit test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of DefaultApi + /// + [Test] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' DefaultApi + //Assert.IsInstanceOfType(typeof(DefaultApi), instance, "instance is a DefaultApi"); + } + + + /// + /// Test FooGet + /// + [Test] + public void FooGetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.FooGet(); + //Assert.IsInstanceOf (response, "response is InlineResponseDefault"); + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 00000000000..eedf488e508 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FooTests + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Foo + /// + [Test] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Foo + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Foo"); + } + + + /// + /// Test the property 'Bar' + /// + [Test] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs new file mode 100644 index 00000000000..135ba44d806 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject1Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject1 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject1Tests + { + // TODO uncomment below to declare an instance variable for InlineObject1 + //private InlineObject1 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject1 + //instance = new InlineObject1(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject1 + /// + [Test] + public void InlineObject1InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject1 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject1"); + } + + + /// + /// Test the property 'AdditionalMetadata' + /// + [Test] + public void AdditionalMetadataTest() + { + // TODO unit test for the property 'AdditionalMetadata' + } + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs new file mode 100644 index 00000000000..7c48afda606 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject2Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject2 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject2Tests + { + // TODO uncomment below to declare an instance variable for InlineObject2 + //private InlineObject2 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject2 + //instance = new InlineObject2(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject2 + /// + [Test] + public void InlineObject2InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject2 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject2"); + } + + + /// + /// Test the property 'EnumFormStringArray' + /// + [Test] + public void EnumFormStringArrayTest() + { + // TODO unit test for the property 'EnumFormStringArray' + } + /// + /// Test the property 'EnumFormString' + /// + [Test] + public void EnumFormStringTest() + { + // TODO unit test for the property 'EnumFormString' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs new file mode 100644 index 00000000000..fc9f4130303 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject3Tests.cs @@ -0,0 +1,184 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject3 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject3Tests + { + // TODO uncomment below to declare an instance variable for InlineObject3 + //private InlineObject3 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject3 + //instance = new InlineObject3(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject3 + /// + [Test] + public void InlineObject3InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject3 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject3"); + } + + + /// + /// Test the property 'Integer' + /// + [Test] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + /// + /// Test the property 'Int32' + /// + [Test] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + /// + /// Test the property 'Int64' + /// + [Test] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + /// + /// Test the property 'Number' + /// + [Test] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + /// + /// Test the property 'Float' + /// + [Test] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + /// + /// Test the property 'Double' + /// + [Test] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + /// + /// Test the property 'String' + /// + [Test] + public void StringTest() + { + // TODO unit test for the property 'String' + } + /// + /// Test the property 'PatternWithoutDelimiter' + /// + [Test] + public void PatternWithoutDelimiterTest() + { + // TODO unit test for the property 'PatternWithoutDelimiter' + } + /// + /// Test the property 'Byte' + /// + [Test] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + /// + /// Test the property 'Binary' + /// + [Test] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// + /// Test the property 'Date' + /// + [Test] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + /// + /// Test the property 'DateTime' + /// + [Test] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + /// + /// Test the property 'Password' + /// + [Test] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// + /// Test the property 'Callback' + /// + [Test] + public void CallbackTest() + { + // TODO unit test for the property 'Callback' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs new file mode 100644 index 00000000000..9cbda37320b --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject4Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject4 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject4Tests + { + // TODO uncomment below to declare an instance variable for InlineObject4 + //private InlineObject4 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject4 + //instance = new InlineObject4(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject4 + /// + [Test] + public void InlineObject4InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject4 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject4"); + } + + + /// + /// Test the property 'Param' + /// + [Test] + public void ParamTest() + { + // TODO unit test for the property 'Param' + } + /// + /// Test the property 'Param2' + /// + [Test] + public void Param2Test() + { + // TODO unit test for the property 'Param2' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs new file mode 100644 index 00000000000..5a4a9d1e811 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObject5Tests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject5 + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObject5Tests + { + // TODO uncomment below to declare an instance variable for InlineObject5 + //private InlineObject5 instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject5 + //instance = new InlineObject5(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject5 + /// + [Test] + public void InlineObject5InstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject5 + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject5"); + } + + + /// + /// Test the property 'AdditionalMetadata' + /// + [Test] + public void AdditionalMetadataTest() + { + // TODO unit test for the property 'AdditionalMetadata' + } + /// + /// Test the property 'RequiredFile' + /// + [Test] + public void RequiredFileTest() + { + // TODO unit test for the property 'RequiredFile' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs new file mode 100644 index 00000000000..816174fe3b9 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineObjectTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineObjectTests + { + // TODO uncomment below to declare an instance variable for InlineObject + //private InlineObject instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineObject + //instance = new InlineObject(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineObject + /// + [Test] + public void InlineObjectInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineObject + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineObject"); + } + + + /// + /// Test the property 'Name' + /// + [Test] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + /// + /// Test the property 'Status' + /// + [Test] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs new file mode 100644 index 00000000000..01b28899823 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/InlineResponseDefaultTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing InlineResponseDefault + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class InlineResponseDefaultTests + { + // TODO uncomment below to declare an instance variable for InlineResponseDefault + //private InlineResponseDefault instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of InlineResponseDefault + //instance = new InlineResponseDefault(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of InlineResponseDefault + /// + [Test] + public void InlineResponseDefaultInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" InlineResponseDefault + //Assert.IsInstanceOfType (instance, "variable 'instance' is a InlineResponseDefault"); + } + + + /// + /// Test the property 'String' + /// + [Test] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 00000000000..715dba60323 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,289 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + InlineResponseDefault FooGet (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + ApiResponse FooGetWithHttpInfo (); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + System.Threading.Tasks.Task FooGetAsync (); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo (); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(String basePath) + { + this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath }; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public IDictionary DefaultHeader() + { + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// InlineResponseDefault + public InlineResponseDefault FooGet () + { + ApiResponse localVarResponse = FooGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of InlineResponseDefault + public ApiResponse< InlineResponseDefault > FooGetWithHttpInfo () + { + + var localVarPath = "/foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of InlineResponseDefault + public async System.Threading.Tasks.Task FooGetAsync () + { + ApiResponse localVarResponse = await FooGetAsyncWithHttpInfo(); + return localVarResponse.Data; + + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (InlineResponseDefault) + public async System.Threading.Tasks.Task> FooGetAsyncWithHttpInfo () + { + + var localVarPath = "/foo"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FooGet", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + } + + } +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index b9444fb3607..1504638f6f2 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs index a172f36022a..a795fc58c58 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs @@ -30,15 +30,28 @@ namespace Org.OpenAPITools.Model [DataContract] public partial class Category : IEquatable, IValidatableObject { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } /// /// Initializes a new instance of the class. /// /// id. - /// name. - public Category(long? id = default(long?), string name = default(string)) + /// name (required) (default to "default-name"). + public Category(long? id = default(long?), string name = "default-name") { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } this.Id = id; - this.Name = name; } /// diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 90c181c11b6..ecd67f40b6e 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 00000000000..394f5adc052 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Foo.cs @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + [DataContract] + public partial class Foo : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar"). + public Foo(string bar = "bar") + { + // use default value if no "bar" provided + if (bar == null) + { + this.Bar = "bar"; + } + else + { + this.Bar = bar; + } + } + + /// + /// Gets or Sets Bar + /// + [DataMember(Name="bar", EmitDefaultValue=false)] + public string Bar { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Foo); + } + + /// + /// Returns true if Foo instances are equal + /// + /// Instance of Foo to be compared + /// Boolean + public bool Equals(Foo input) + { + if (input == null) + return false; + + return + ( + this.Bar == input.Bar || + (this.Bar != null && + this.Bar.Equals(input.Bar)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Bar != null) + hashCode = hashCode * 59 + this.Bar.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject.cs new file mode 100644 index 00000000000..95ea944a8c6 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject.cs @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject + /// + [DataContract] + public partial class InlineObject : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Updated name of the pet. + /// Updated status of the pet. + public InlineObject(string name = default(string), string status = default(string)) + { + this.Name = name; + this.Status = status; + } + + /// + /// Updated name of the pet + /// + /// Updated name of the pet + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Updated status of the pet + /// + /// Updated status of the pet + [DataMember(Name="status", EmitDefaultValue=false)] + public string Status { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject); + } + + /// + /// Returns true if InlineObject instances are equal + /// + /// Instance of InlineObject to be compared + /// Boolean + public bool Equals(InlineObject input) + { + if (input == null) + return false; + + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.Status != null) + hashCode = hashCode * 59 + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject1.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject1.cs new file mode 100644 index 00000000000..473147e6749 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject1.cs @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject1 + /// + [DataContract] + public partial class InlineObject1 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload. + public InlineObject1(string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)) + { + this.AdditionalMetadata = additionalMetadata; + this.File = file; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject1 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject1); + } + + /// + /// Returns true if InlineObject1 instances are equal + /// + /// Instance of InlineObject1 to be compared + /// Boolean + public bool Equals(InlineObject1 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject2.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject2.cs new file mode 100644 index 00000000000..c354d941f27 --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject2.cs @@ -0,0 +1,198 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject2 + /// + [DataContract] + public partial class InlineObject2 : IEquatable, IValidatableObject + { + /// + /// Defines EnumFormStringArray + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringArrayEnum + { + /// + /// Enum GreaterThan for value: > + /// + [EnumMember(Value = ">")] + GreaterThan = 1, + + /// + /// Enum Dollar for value: $ + /// + [EnumMember(Value = "$")] + Dollar = 2 + + } + + + /// + /// Form parameter enum test (string array) + /// + /// Form parameter enum test (string array) + [DataMember(Name="enum_form_string_array", EmitDefaultValue=false)] + public List EnumFormStringArray { get; set; } + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumFormStringEnum + { + /// + /// Enum Abc for value: _abc + /// + [EnumMember(Value = "_abc")] + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + [EnumMember(Value = "-efg")] + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + [EnumMember(Value = "(xyz)")] + Xyz = 3 + + } + + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + [DataMember(Name="enum_form_string", EmitDefaultValue=false)] + public EnumFormStringEnum? EnumFormString { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Form parameter enum test (string array). + /// Form parameter enum test (string) (default to EnumFormStringEnum.Efg). + public InlineObject2(List enumFormStringArray = default(List), EnumFormStringEnum? enumFormString = EnumFormStringEnum.Efg) + { + this.EnumFormStringArray = enumFormStringArray; + // use default value if no "enumFormString" provided + if (enumFormString == null) + { + this.EnumFormString = EnumFormStringEnum.Efg; + } + else + { + this.EnumFormString = enumFormString; + } + } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject2 {\n"); + sb.Append(" EnumFormStringArray: ").Append(EnumFormStringArray).Append("\n"); + sb.Append(" EnumFormString: ").Append(EnumFormString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject2); + } + + /// + /// Returns true if InlineObject2 instances are equal + /// + /// Instance of InlineObject2 to be compared + /// Boolean + public bool Equals(InlineObject2 input) + { + if (input == null) + return false; + + return + ( + this.EnumFormStringArray == input.EnumFormStringArray || + this.EnumFormStringArray != null && + this.EnumFormStringArray.SequenceEqual(input.EnumFormStringArray) + ) && + ( + this.EnumFormString == input.EnumFormString || + (this.EnumFormString != null && + this.EnumFormString.Equals(input.EnumFormString)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EnumFormStringArray != null) + hashCode = hashCode * 59 + this.EnumFormStringArray.GetHashCode(); + if (this.EnumFormString != null) + hashCode = hashCode * 59 + this.EnumFormString.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject3.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject3.cs new file mode 100644 index 00000000000..cb7c53f698d --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject3.cs @@ -0,0 +1,464 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject3 + /// + [DataContract] + public partial class InlineObject3 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject3() { } + /// + /// Initializes a new instance of the class. + /// + /// None. + /// None. + /// None. + /// None (required). + /// None. + /// None (required). + /// None. + /// None (required). + /// None (required). + /// None. + /// None. + /// None. + /// None. + /// None. + public InlineObject3(int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), decimal? number = default(decimal?), float? _float = default(float?), double? _double = default(double?), string _string = default(string), string patternWithoutDelimiter = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) + { + // to ensure "number" is required (not null) + if (number == null) + { + throw new InvalidDataException("number is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Number = number; + } + // to ensure "_double" is required (not null) + if (_double == null) + { + throw new InvalidDataException("_double is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Double = _double; + } + // to ensure "patternWithoutDelimiter" is required (not null) + if (patternWithoutDelimiter == null) + { + throw new InvalidDataException("patternWithoutDelimiter is a required property for InlineObject3 and cannot be null"); + } + else + { + this.PatternWithoutDelimiter = patternWithoutDelimiter; + } + // to ensure "_byte" is required (not null) + if (_byte == null) + { + throw new InvalidDataException("_byte is a required property for InlineObject3 and cannot be null"); + } + else + { + this.Byte = _byte; + } + this.Integer = integer; + this.Int32 = int32; + this.Int64 = int64; + this.Float = _float; + this.String = _string; + this.Binary = binary; + this.Date = date; + this.DateTime = dateTime; + this.Password = password; + this.Callback = callback; + } + + /// + /// None + /// + /// None + [DataMember(Name="integer", EmitDefaultValue=false)] + public int? Integer { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int32", EmitDefaultValue=false)] + public int? Int32 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="int64", EmitDefaultValue=false)] + public long? Int64 { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="number", EmitDefaultValue=false)] + public decimal? Number { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="float", EmitDefaultValue=false)] + public float? Float { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="double", EmitDefaultValue=false)] + public double? Double { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="string", EmitDefaultValue=false)] + public string String { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="pattern_without_delimiter", EmitDefaultValue=false)] + public string PatternWithoutDelimiter { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="byte", EmitDefaultValue=false)] + public byte[] Byte { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="binary", EmitDefaultValue=false)] + public System.IO.Stream Binary { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="date", EmitDefaultValue=false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? Date { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="dateTime", EmitDefaultValue=false)] + public DateTime? DateTime { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// + /// None + /// + /// None + [DataMember(Name="callback", EmitDefaultValue=false)] + public string Callback { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject3 {\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" PatternWithoutDelimiter: ").Append(PatternWithoutDelimiter).Append("\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Callback: ").Append(Callback).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject3); + } + + /// + /// Returns true if InlineObject3 instances are equal + /// + /// Instance of InlineObject3 to be compared + /// Boolean + public bool Equals(InlineObject3 input) + { + if (input == null) + return false; + + return + ( + this.Integer == input.Integer || + (this.Integer != null && + this.Integer.Equals(input.Integer)) + ) && + ( + this.Int32 == input.Int32 || + (this.Int32 != null && + this.Int32.Equals(input.Int32)) + ) && + ( + this.Int64 == input.Int64 || + (this.Int64 != null && + this.Int64.Equals(input.Int64)) + ) && + ( + this.Number == input.Number || + (this.Number != null && + this.Number.Equals(input.Number)) + ) && + ( + this.Float == input.Float || + (this.Float != null && + this.Float.Equals(input.Float)) + ) && + ( + this.Double == input.Double || + (this.Double != null && + this.Double.Equals(input.Double)) + ) && + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ) && + ( + this.PatternWithoutDelimiter == input.PatternWithoutDelimiter || + (this.PatternWithoutDelimiter != null && + this.PatternWithoutDelimiter.Equals(input.PatternWithoutDelimiter)) + ) && + ( + this.Byte == input.Byte || + (this.Byte != null && + this.Byte.Equals(input.Byte)) + ) && + ( + this.Binary == input.Binary || + (this.Binary != null && + this.Binary.Equals(input.Binary)) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.DateTime == input.DateTime || + (this.DateTime != null && + this.DateTime.Equals(input.DateTime)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ) && + ( + this.Callback == input.Callback || + (this.Callback != null && + this.Callback.Equals(input.Callback)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Integer != null) + hashCode = hashCode * 59 + this.Integer.GetHashCode(); + if (this.Int32 != null) + hashCode = hashCode * 59 + this.Int32.GetHashCode(); + if (this.Int64 != null) + hashCode = hashCode * 59 + this.Int64.GetHashCode(); + if (this.Number != null) + hashCode = hashCode * 59 + this.Number.GetHashCode(); + if (this.Float != null) + hashCode = hashCode * 59 + this.Float.GetHashCode(); + if (this.Double != null) + hashCode = hashCode * 59 + this.Double.GetHashCode(); + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + if (this.PatternWithoutDelimiter != null) + hashCode = hashCode * 59 + this.PatternWithoutDelimiter.GetHashCode(); + if (this.Byte != null) + hashCode = hashCode * 59 + this.Byte.GetHashCode(); + if (this.Binary != null) + hashCode = hashCode * 59 + this.Binary.GetHashCode(); + if (this.Date != null) + hashCode = hashCode * 59 + this.Date.GetHashCode(); + if (this.DateTime != null) + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + if (this.Callback != null) + hashCode = hashCode * 59 + this.Callback.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Integer (int?) maximum + if(this.Integer > (int?)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int?) minimum + if(this.Integer < (int?)10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + // Int32 (int?) maximum + if(this.Int32 > (int?)200) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int?) minimum + if(this.Int32 < (int?)20) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Number (decimal?) maximum + if(this.Number > (decimal?)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal?) minimum + if(this.Number < (decimal?)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Float (float?) maximum + if(this.Float > (float?)987.6) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Double (double?) maximum + if(this.Double > (double?)123.4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double?) minimum + if(this.Double < (double?)67.8) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (false == regexString.Match(this.String).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + + // PatternWithoutDelimiter (string) pattern + Regex regexPatternWithoutDelimiter = new Regex(@"^[A-Z].*", RegexOptions.CultureInvariant); + if (false == regexPatternWithoutDelimiter.Match(this.PatternWithoutDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithoutDelimiter, must match a pattern of " + regexPatternWithoutDelimiter, new [] { "PatternWithoutDelimiter" }); + } + + // Password (string) maxLength + if(this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if(this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject4.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject4.cs new file mode 100644 index 00000000000..70326154bfc --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject4.cs @@ -0,0 +1,163 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject4 + /// + [DataContract] + public partial class InlineObject4 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject4() { } + /// + /// Initializes a new instance of the class. + /// + /// field1 (required). + /// field2 (required). + public InlineObject4(string param = default(string), string param2 = default(string)) + { + // to ensure "param" is required (not null) + if (param == null) + { + throw new InvalidDataException("param is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param = param; + } + // to ensure "param2" is required (not null) + if (param2 == null) + { + throw new InvalidDataException("param2 is a required property for InlineObject4 and cannot be null"); + } + else + { + this.Param2 = param2; + } + } + + /// + /// field1 + /// + /// field1 + [DataMember(Name="param", EmitDefaultValue=false)] + public string Param { get; set; } + + /// + /// field2 + /// + /// field2 + [DataMember(Name="param2", EmitDefaultValue=false)] + public string Param2 { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject4 {\n"); + sb.Append(" Param: ").Append(Param).Append("\n"); + sb.Append(" Param2: ").Append(Param2).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject4); + } + + /// + /// Returns true if InlineObject4 instances are equal + /// + /// Instance of InlineObject4 to be compared + /// Boolean + public bool Equals(InlineObject4 input) + { + if (input == null) + return false; + + return + ( + this.Param == input.Param || + (this.Param != null && + this.Param.Equals(input.Param)) + ) && + ( + this.Param2 == input.Param2 || + (this.Param2 != null && + this.Param2.Equals(input.Param2)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Param != null) + hashCode = hashCode * 59 + this.Param.GetHashCode(); + if (this.Param2 != null) + hashCode = hashCode * 59 + this.Param2.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject5.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject5.cs new file mode 100644 index 00000000000..8821e41a8ac --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineObject5.cs @@ -0,0 +1,155 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineObject5 + /// + [DataContract] + public partial class InlineObject5 : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InlineObject5() { } + /// + /// Initializes a new instance of the class. + /// + /// Additional data to pass to server. + /// file to upload (required). + public InlineObject5(string additionalMetadata = default(string), System.IO.Stream requiredFile = default(System.IO.Stream)) + { + // to ensure "requiredFile" is required (not null) + if (requiredFile == null) + { + throw new InvalidDataException("requiredFile is a required property for InlineObject5 and cannot be null"); + } + else + { + this.RequiredFile = requiredFile; + } + this.AdditionalMetadata = additionalMetadata; + } + + /// + /// Additional data to pass to server + /// + /// Additional data to pass to server + [DataMember(Name="additionalMetadata", EmitDefaultValue=false)] + public string AdditionalMetadata { get; set; } + + /// + /// file to upload + /// + /// file to upload + [DataMember(Name="requiredFile", EmitDefaultValue=false)] + public System.IO.Stream RequiredFile { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineObject5 {\n"); + sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n"); + sb.Append(" RequiredFile: ").Append(RequiredFile).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineObject5); + } + + /// + /// Returns true if InlineObject5 instances are equal + /// + /// Instance of InlineObject5 to be compared + /// Boolean + public bool Equals(InlineObject5 input) + { + if (input == null) + return false; + + return + ( + this.AdditionalMetadata == input.AdditionalMetadata || + (this.AdditionalMetadata != null && + this.AdditionalMetadata.Equals(input.AdditionalMetadata)) + ) && + ( + this.RequiredFile == input.RequiredFile || + (this.RequiredFile != null && + this.RequiredFile.Equals(input.RequiredFile)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AdditionalMetadata != null) + hashCode = hashCode * 59 + this.AdditionalMetadata.GetHashCode(); + if (this.RequiredFile != null) + hashCode = hashCode * 59 + this.RequiredFile.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs new file mode 100644 index 00000000000..a264f2e0b2f --- /dev/null +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/InlineResponseDefault.cs @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// InlineResponseDefault + /// + [DataContract] + public partial class InlineResponseDefault : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public InlineResponseDefault(Foo _string = default(Foo)) + { + this.String = _string; + } + + /// + /// Gets or Sets String + /// + [DataMember(Name="string", EmitDefaultValue=false)] + public Foo String { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineResponseDefault {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InlineResponseDefault); + } + + /// + /// Returns true if InlineResponseDefault instances are equal + /// + /// Instance of InlineResponseDefault to be compared + /// Boolean + public bool Equals(InlineResponseDefault input) + { + if (input == null) + return false; + + return + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs index 1c5bfa70198..3f44bcf22ea 100644 --- a/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/openapi3/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md index b42462087c7..d96d603e9c6 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md @@ -80,6 +80,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo | *FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -124,12 +125,6 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/Model/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/Model/ArrayOfNumberOnly.md) - [ArrayTest](docs/Model/ArrayTest.md) - - [Body](docs/Model/Body.md) - - [Body1](docs/Model/Body1.md) - - [Body2](docs/Model/Body2.md) - - [Body3](docs/Model/Body3.md) - - [Body4](docs/Model/Body4.md) - - [Body5](docs/Model/Body5.md) - [Capitalization](docs/Model/Capitalization.md) - [Cat](docs/Model/Cat.md) - [Category](docs/Model/Category.md) @@ -141,8 +136,16 @@ Class | Method | HTTP request | Description - [EnumTest](docs/Model/EnumTest.md) - [File](docs/Model/File.md) - [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md) + - [Foo](docs/Model/Foo.md) - [FormatTest](docs/Model/FormatTest.md) - [HasOnlyReadOnly](docs/Model/HasOnlyReadOnly.md) + - [InlineObject](docs/Model/InlineObject.md) + - [InlineObject1](docs/Model/InlineObject1.md) + - [InlineObject2](docs/Model/InlineObject2.md) + - [InlineObject3](docs/Model/InlineObject3.md) + - [InlineObject4](docs/Model/InlineObject4.md) + - [InlineObject5](docs/Model/InlineObject5.md) + - [InlineResponseDefault](docs/Model/InlineResponseDefault.md) - [MapTest](docs/Model/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model/Model200Response.md) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md new file mode 100644 index 00000000000..6696bd33785 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md @@ -0,0 +1,52 @@ +# OpenAPI\Client\DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + +# **fooGet** +> \OpenAPI\Client\Model\InlineResponseDefault fooGet() + + + +### Example +```php +fooGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->fooGet: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\InlineResponseDefault**](../Model/InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md index 80aef312e5e..369f811a4eb 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**name** | **string** | | [optional] +**name** | **string** | | [default to 'default-name'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Foo.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Foo.md new file mode 100644 index 00000000000..ee5ddff7206 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Foo.md @@ -0,0 +1,10 @@ +# Foo + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **string** | | [optional] [default to 'bar'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject.md new file mode 100644 index 00000000000..101275879be --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject.md @@ -0,0 +1,11 @@ +# InlineObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Updated name of the pet | [optional] +**status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject1.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject1.md new file mode 100644 index 00000000000..dc428e8ea6c --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject1.md @@ -0,0 +1,11 @@ +# InlineObject1 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **string** | Additional data to pass to server | [optional] +**file** | [**\SplFileObject**](\SplFileObject.md) | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject2.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject2.md new file mode 100644 index 00000000000..7e2ee7c9570 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject2.md @@ -0,0 +1,11 @@ +# InlineObject2 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_form_string_array** | **string[]** | Form parameter enum test (string array) | [optional] +**enum_form_string** | **string** | Form parameter enum test (string) | [optional] [default to '-efg'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject3.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject3.md new file mode 100644 index 00000000000..cef75b28262 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject3.md @@ -0,0 +1,23 @@ +# InlineObject3 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | None | [optional] +**int32** | **int** | None | [optional] +**int64** | **int** | None | [optional] +**number** | **float** | None | +**float** | **float** | None | [optional] +**double** | **double** | None | +**string** | **string** | None | [optional] +**pattern_without_delimiter** | **string** | None | +**byte** | **string** | None | +**binary** | [**\SplFileObject**](\SplFileObject.md) | None | [optional] +**date** | [**\DateTime**](\DateTime.md) | None | [optional] +**date_time** | [**\DateTime**](\DateTime.md) | None | [optional] +**password** | **string** | None | [optional] +**callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject4.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject4.md new file mode 100644 index 00000000000..6675b7f47ce --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject4.md @@ -0,0 +1,11 @@ +# InlineObject4 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **string** | field1 | +**param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject5.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject5.md new file mode 100644 index 00000000000..d1d27f7cc65 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineObject5.md @@ -0,0 +1,11 @@ +# InlineObject5 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **string** | Additional data to pass to server | [optional] +**required_file** | [**\SplFileObject**](\SplFileObject.md) | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineResponseDefault.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineResponseDefault.md new file mode 100644 index 00000000000..9f25c169f64 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/InlineResponseDefault.md @@ -0,0 +1,10 @@ +# InlineResponseDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**\OpenAPI\Client\Model\Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php new file mode 100644 index 00000000000..2f76939a1f3 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -0,0 +1,357 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation fooGet + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\InlineResponseDefault + */ + public function fooGet() + { + list($response) = $this->fooGetWithHttpInfo(); + return $response; + } + + /** + * Operation fooGetWithHttpInfo + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\InlineResponseDefault, HTTP status code, HTTP response headers (array of strings) + */ + public function fooGetWithHttpInfo() + { + $request = $this->fooGetRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + default: + if ('\OpenAPI\Client\Model\InlineResponseDefault' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InlineResponseDefault', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\InlineResponseDefault', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fooGetAsync + * + * + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fooGetAsync() + { + return $this->fooGetAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fooGetAsyncWithHttpInfo + * + * + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fooGetAsyncWithHttpInfo() + { + $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; + $request = $this->fooGetRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fooGet' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function fooGetRequest() + { + + $resourcePath = '/foo'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php index 2932a5b7614..d810bd91fc8 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php @@ -183,7 +183,7 @@ class Category implements ModelInterface, ArrayAccess public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : 'default-name'; } /** @@ -195,6 +195,9 @@ class Category implements ModelInterface, ArrayAccess { $invalidProperties = []; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } return $invalidProperties; } @@ -237,7 +240,7 @@ class Category implements ModelInterface, ArrayAccess /** * Gets name * - * @return string|null + * @return string */ public function getName() { @@ -247,7 +250,7 @@ class Category implements ModelInterface, ArrayAccess /** * Sets name * - * @param string|null $name name + * @param string $name name * * @return $this */ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php new file mode 100644 index 00000000000..0ebf2979219 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php @@ -0,0 +1,297 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'bar' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bar' => 'bar' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bar' => 'setBar' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bar' => 'getBar' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['bar'] = isset($data['bar']) ? $data['bar'] : 'bar'; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bar + * + * @return string|null + */ + public function getBar() + { + return $this->container['bar']; + } + + /** + * Sets bar + * + * @param string|null $bar bar + * + * @return $this + */ + public function setBar($bar) + { + $this->container['bar'] = $bar; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php new file mode 100644 index 00000000000..c9eb84537fb --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php @@ -0,0 +1,327 @@ + 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'status' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Updated name of the pet + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Updated status of the pet + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php new file mode 100644 index 00000000000..dba124de95f --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php @@ -0,0 +1,327 @@ + 'string', + 'file' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'additional_metadata' => null, + 'file' => 'binary' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'additional_metadata' => 'additionalMetadata', + 'file' => 'file' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'additional_metadata' => 'setAdditionalMetadata', + 'file' => 'setFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'additional_metadata' => 'getAdditionalMetadata', + 'file' => 'getFile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; + $this->container['file'] = isset($data['file']) ? $data['file'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets additional_metadata + * + * @return string|null + */ + public function getAdditionalMetadata() + { + return $this->container['additional_metadata']; + } + + /** + * Sets additional_metadata + * + * @param string|null $additional_metadata Additional data to pass to server + * + * @return $this + */ + public function setAdditionalMetadata($additional_metadata) + { + $this->container['additional_metadata'] = $additional_metadata; + + return $this; + } + + /** + * Gets file + * + * @return \SplFileObject|null + */ + public function getFile() + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param \SplFileObject|null $file file to upload + * + * @return $this + */ + public function setFile($file) + { + $this->container['file'] = $file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php new file mode 100644 index 00000000000..9fd716d3aa2 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php @@ -0,0 +1,385 @@ + 'string[]', + 'enum_form_string' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'enum_form_string_array' => null, + 'enum_form_string' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enum_form_string_array' => 'enum_form_string_array', + 'enum_form_string' => 'enum_form_string' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enum_form_string_array' => 'setEnumFormStringArray', + 'enum_form_string' => 'setEnumFormString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enum_form_string_array' => 'getEnumFormStringArray', + 'enum_form_string' => 'getEnumFormString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const ENUM_FORM_STRING_ARRAY_GREATER_THAN = '>'; + const ENUM_FORM_STRING_ARRAY_DOLLAR = '$'; + const ENUM_FORM_STRING_ABC = '_abc'; + const ENUM_FORM_STRING_EFG = '-efg'; + const ENUM_FORM_STRING_XYZ = '(xyz)'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEnumFormStringArrayAllowableValues() + { + return [ + self::ENUM_FORM_STRING_ARRAY_GREATER_THAN, + self::ENUM_FORM_STRING_ARRAY_DOLLAR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEnumFormStringAllowableValues() + { + return [ + self::ENUM_FORM_STRING_ABC, + self::ENUM_FORM_STRING_EFG, + self::ENUM_FORM_STRING_XYZ, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['enum_form_string_array'] = isset($data['enum_form_string_array']) ? $data['enum_form_string_array'] : null; + $this->container['enum_form_string'] = isset($data['enum_form_string']) ? $data['enum_form_string'] : '-efg'; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getEnumFormStringAllowableValues(); + if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'enum_form_string', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enum_form_string_array + * + * @return string[]|null + */ + public function getEnumFormStringArray() + { + return $this->container['enum_form_string_array']; + } + + /** + * Sets enum_form_string_array + * + * @param string[]|null $enum_form_string_array Form parameter enum test (string array) + * + * @return $this + */ + public function setEnumFormStringArray($enum_form_string_array) + { + $allowedValues = $this->getEnumFormStringArrayAllowableValues(); + if (!is_null($enum_form_string_array) && array_diff($enum_form_string_array, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'enum_form_string_array', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['enum_form_string_array'] = $enum_form_string_array; + + return $this; + } + + /** + * Gets enum_form_string + * + * @return string|null + */ + public function getEnumFormString() + { + return $this->container['enum_form_string']; + } + + /** + * Sets enum_form_string + * + * @param string|null $enum_form_string Form parameter enum test (string) + * + * @return $this + */ + public function setEnumFormString($enum_form_string) + { + $allowedValues = $this->getEnumFormStringAllowableValues(); + if (!is_null($enum_form_string) && !in_array($enum_form_string, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'enum_form_string', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['enum_form_string'] = $enum_form_string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php new file mode 100644 index 00000000000..3f69ef36f1b --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php @@ -0,0 +1,805 @@ + 'int', + 'int32' => 'int', + 'int64' => 'int', + 'number' => 'float', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'pattern_without_delimiter' => 'string', + 'byte' => 'string', + 'binary' => '\SplFileObject', + 'date' => '\DateTime', + 'date_time' => '\DateTime', + 'password' => 'string', + 'callback' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'integer' => 'int32', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => null, + 'float' => 'float', + 'double' => 'double', + 'string' => null, + 'pattern_without_delimiter' => null, + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'date-time', + 'password' => 'password', + 'callback' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'integer' => 'integer', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => 'number', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'pattern_without_delimiter' => 'pattern_without_delimiter', + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'dateTime', + 'password' => 'password', + 'callback' => 'callback' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'integer' => 'setInteger', + 'int32' => 'setInt32', + 'int64' => 'setInt64', + 'number' => 'setNumber', + 'float' => 'setFloat', + 'double' => 'setDouble', + 'string' => 'setString', + 'pattern_without_delimiter' => 'setPatternWithoutDelimiter', + 'byte' => 'setByte', + 'binary' => 'setBinary', + 'date' => 'setDate', + 'date_time' => 'setDateTime', + 'password' => 'setPassword', + 'callback' => 'setCallback' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'integer' => 'getInteger', + 'int32' => 'getInt32', + 'int64' => 'getInt64', + 'number' => 'getNumber', + 'float' => 'getFloat', + 'double' => 'getDouble', + 'string' => 'getString', + 'pattern_without_delimiter' => 'getPatternWithoutDelimiter', + 'byte' => 'getByte', + 'binary' => 'getBinary', + 'date' => 'getDate', + 'date_time' => 'getDateTime', + 'password' => 'getPassword', + 'callback' => 'getCallback' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['pattern_without_delimiter'] = isset($data['pattern_without_delimiter']) ? $data['pattern_without_delimiter'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['callback'] = isset($data['callback']) ? $data['callback'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['integer']) && ($this->container['integer'] > 100)) { + $invalidProperties[] = "invalid value for 'integer', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['integer']) && ($this->container['integer'] < 10)) { + $invalidProperties[] = "invalid value for 'integer', must be bigger than or equal to 10."; + } + + if (!is_null($this->container['int32']) && ($this->container['int32'] > 200)) { + $invalidProperties[] = "invalid value for 'int32', must be smaller than or equal to 200."; + } + + if (!is_null($this->container['int32']) && ($this->container['int32'] < 20)) { + $invalidProperties[] = "invalid value for 'int32', must be bigger than or equal to 20."; + } + + if ($this->container['number'] === null) { + $invalidProperties[] = "'number' can't be null"; + } + if (($this->container['number'] > 543.2)) { + $invalidProperties[] = "invalid value for 'number', must be smaller than or equal to 543.2."; + } + + if (($this->container['number'] < 32.1)) { + $invalidProperties[] = "invalid value for 'number', must be bigger than or equal to 32.1."; + } + + if (!is_null($this->container['float']) && ($this->container['float'] > 987.6)) { + $invalidProperties[] = "invalid value for 'float', must be smaller than or equal to 987.6."; + } + + if ($this->container['double'] === null) { + $invalidProperties[] = "'double' can't be null"; + } + if (($this->container['double'] > 123.4)) { + $invalidProperties[] = "invalid value for 'double', must be smaller than or equal to 123.4."; + } + + if (($this->container['double'] < 67.8)) { + $invalidProperties[] = "invalid value for 'double', must be bigger than or equal to 67.8."; + } + + if (!is_null($this->container['string']) && !preg_match("/[a-z]/i", $this->container['string'])) { + $invalidProperties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i."; + } + + if ($this->container['pattern_without_delimiter'] === null) { + $invalidProperties[] = "'pattern_without_delimiter' can't be null"; + } + if (!preg_match("/^[A-Z].*/", $this->container['pattern_without_delimiter'])) { + $invalidProperties[] = "invalid value for 'pattern_without_delimiter', must be conform to the pattern /^[A-Z].*/."; + } + + if ($this->container['byte'] === null) { + $invalidProperties[] = "'byte' can't be null"; + } + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 64)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 64."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) < 10)) { + $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 10."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets integer + * + * @return int|null + */ + public function getInteger() + { + return $this->container['integer']; + } + + /** + * Sets integer + * + * @param int|null $integer None + * + * @return $this + */ + public function setInteger($integer) + { + + if (!is_null($integer) && ($integer > 100)) { + throw new \InvalidArgumentException('invalid value for $integer when calling InlineObject3., must be smaller than or equal to 100.'); + } + if (!is_null($integer) && ($integer < 10)) { + throw new \InvalidArgumentException('invalid value for $integer when calling InlineObject3., must be bigger than or equal to 10.'); + } + + $this->container['integer'] = $integer; + + return $this; + } + + /** + * Gets int32 + * + * @return int|null + */ + public function getInt32() + { + return $this->container['int32']; + } + + /** + * Sets int32 + * + * @param int|null $int32 None + * + * @return $this + */ + public function setInt32($int32) + { + + if (!is_null($int32) && ($int32 > 200)) { + throw new \InvalidArgumentException('invalid value for $int32 when calling InlineObject3., must be smaller than or equal to 200.'); + } + if (!is_null($int32) && ($int32 < 20)) { + throw new \InvalidArgumentException('invalid value for $int32 when calling InlineObject3., must be bigger than or equal to 20.'); + } + + $this->container['int32'] = $int32; + + return $this; + } + + /** + * Gets int64 + * + * @return int|null + */ + public function getInt64() + { + return $this->container['int64']; + } + + /** + * Sets int64 + * + * @param int|null $int64 None + * + * @return $this + */ + public function setInt64($int64) + { + $this->container['int64'] = $int64; + + return $this; + } + + /** + * Gets number + * + * @return float + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param float $number None + * + * @return $this + */ + public function setNumber($number) + { + + if (($number > 543.2)) { + throw new \InvalidArgumentException('invalid value for $number when calling InlineObject3., must be smaller than or equal to 543.2.'); + } + if (($number < 32.1)) { + throw new \InvalidArgumentException('invalid value for $number when calling InlineObject3., must be bigger than or equal to 32.1.'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets float + * + * @return float|null + */ + public function getFloat() + { + return $this->container['float']; + } + + /** + * Sets float + * + * @param float|null $float None + * + * @return $this + */ + public function setFloat($float) + { + + if (!is_null($float) && ($float > 987.6)) { + throw new \InvalidArgumentException('invalid value for $float when calling InlineObject3., must be smaller than or equal to 987.6.'); + } + + $this->container['float'] = $float; + + return $this; + } + + /** + * Gets double + * + * @return double + */ + public function getDouble() + { + return $this->container['double']; + } + + /** + * Sets double + * + * @param double $double None + * + * @return $this + */ + public function setDouble($double) + { + + if (($double > 123.4)) { + throw new \InvalidArgumentException('invalid value for $double when calling InlineObject3., must be smaller than or equal to 123.4.'); + } + if (($double < 67.8)) { + throw new \InvalidArgumentException('invalid value for $double when calling InlineObject3., must be bigger than or equal to 67.8.'); + } + + $this->container['double'] = $double; + + return $this; + } + + /** + * Gets string + * + * @return string|null + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param string|null $string None + * + * @return $this + */ + public function setString($string) + { + + if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) { + throw new \InvalidArgumentException("invalid value for $string when calling InlineObject3., must conform to the pattern /[a-z]/i."); + } + + $this->container['string'] = $string; + + return $this; + } + + /** + * Gets pattern_without_delimiter + * + * @return string + */ + public function getPatternWithoutDelimiter() + { + return $this->container['pattern_without_delimiter']; + } + + /** + * Sets pattern_without_delimiter + * + * @param string $pattern_without_delimiter None + * + * @return $this + */ + public function setPatternWithoutDelimiter($pattern_without_delimiter) + { + + if ((!preg_match("/^[A-Z].*/", $pattern_without_delimiter))) { + throw new \InvalidArgumentException("invalid value for $pattern_without_delimiter when calling InlineObject3., must conform to the pattern /^[A-Z].*/."); + } + + $this->container['pattern_without_delimiter'] = $pattern_without_delimiter; + + return $this; + } + + /** + * Gets byte + * + * @return string + */ + public function getByte() + { + return $this->container['byte']; + } + + /** + * Sets byte + * + * @param string $byte None + * + * @return $this + */ + public function setByte($byte) + { + $this->container['byte'] = $byte; + + return $this; + } + + /** + * Gets binary + * + * @return \SplFileObject|null + */ + public function getBinary() + { + return $this->container['binary']; + } + + /** + * Sets binary + * + * @param \SplFileObject|null $binary None + * + * @return $this + */ + public function setBinary($binary) + { + $this->container['binary'] = $binary; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date None + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets date_time + * + * @return \DateTime|null + */ + public function getDateTime() + { + return $this->container['date_time']; + } + + /** + * Sets date_time + * + * @param \DateTime|null $date_time None + * + * @return $this + */ + public function setDateTime($date_time) + { + $this->container['date_time'] = $date_time; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password None + * + * @return $this + */ + public function setPassword($password) + { + if (!is_null($password) && (mb_strlen($password) > 64)) { + throw new \InvalidArgumentException('invalid length for $password when calling InlineObject3., must be smaller than or equal to 64.'); + } + if (!is_null($password) && (mb_strlen($password) < 10)) { + throw new \InvalidArgumentException('invalid length for $password when calling InlineObject3., must be bigger than or equal to 10.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets callback + * + * @return string|null + */ + public function getCallback() + { + return $this->container['callback']; + } + + /** + * Sets callback + * + * @param string|null $callback None + * + * @return $this + */ + public function setCallback($callback) + { + $this->container['callback'] = $callback; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php new file mode 100644 index 00000000000..2f0d8f82320 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php @@ -0,0 +1,333 @@ + 'string', + 'param2' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'param' => null, + 'param2' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'param' => 'param', + 'param2' => 'param2' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'param' => 'setParam', + 'param2' => 'setParam2' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'param' => 'getParam', + 'param2' => 'getParam2' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['param'] = isset($data['param']) ? $data['param'] : null; + $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['param'] === null) { + $invalidProperties[] = "'param' can't be null"; + } + if ($this->container['param2'] === null) { + $invalidProperties[] = "'param2' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets param + * + * @return string + */ + public function getParam() + { + return $this->container['param']; + } + + /** + * Sets param + * + * @param string $param field1 + * + * @return $this + */ + public function setParam($param) + { + $this->container['param'] = $param; + + return $this; + } + + /** + * Gets param2 + * + * @return string + */ + public function getParam2() + { + return $this->container['param2']; + } + + /** + * Sets param2 + * + * @param string $param2 field2 + * + * @return $this + */ + public function setParam2($param2) + { + $this->container['param2'] = $param2; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php new file mode 100644 index 00000000000..30adb429079 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php @@ -0,0 +1,330 @@ + 'string', + 'required_file' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'additional_metadata' => null, + 'required_file' => 'binary' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'additional_metadata' => 'additionalMetadata', + 'required_file' => 'requiredFile' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'additional_metadata' => 'setAdditionalMetadata', + 'required_file' => 'setRequiredFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'additional_metadata' => 'getAdditionalMetadata', + 'required_file' => 'getRequiredFile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; + $this->container['required_file'] = isset($data['required_file']) ? $data['required_file'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['required_file'] === null) { + $invalidProperties[] = "'required_file' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets additional_metadata + * + * @return string|null + */ + public function getAdditionalMetadata() + { + return $this->container['additional_metadata']; + } + + /** + * Sets additional_metadata + * + * @param string|null $additional_metadata Additional data to pass to server + * + * @return $this + */ + public function setAdditionalMetadata($additional_metadata) + { + $this->container['additional_metadata'] = $additional_metadata; + + return $this; + } + + /** + * Gets required_file + * + * @return \SplFileObject + */ + public function getRequiredFile() + { + return $this->container['required_file']; + } + + /** + * Sets required_file + * + * @param \SplFileObject $required_file file to upload + * + * @return $this + */ + public function setRequiredFile($required_file) + { + $this->container['required_file'] = $required_file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php new file mode 100644 index 00000000000..1a44ecae2e9 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php @@ -0,0 +1,297 @@ + '\OpenAPI\Client\Model\Foo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'string' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'string' => 'string' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'string' => 'setString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'string' => 'getString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets string + * + * @return \OpenAPI\Client\Model\Foo|null + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param \OpenAPI\Client\Model\Foo|null $string string + * + * @return $this + */ + public function setString($string) + { + $this->container['string'] = $string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/DefaultApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/DefaultApiTest.php new file mode 100644 index 00000000000..1b6ff232b54 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/DefaultApiTest.php @@ -0,0 +1,83 @@ +, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray +,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble +,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray +,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString,securityContext); + } + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + + @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) @Valid Map requestBody +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testInlineAdditionalProperties(requestBody,securityContext); + } + @GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + + @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param +,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2 +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testJsonFormData(param,param2,securityContext); + } + @POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "uploads an image (required)", notes = "", response = ModelApiResponse.class, 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 = ModelApiResponse.class) }) + public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId +, + @FormDataParam("requiredFile") InputStream requiredFileInputStream, + @FormDataParam("requiredFile") FormDataContentDisposition requiredFileDetail +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java new file mode 100644 index 00000000000..b4d3c8db5be --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java @@ -0,0 +1,40 @@ +package org.openapitools.api; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import java.math.BigDecimal; +import org.openapitools.model.Client; +import java.util.Date; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class FakeApiService { + public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; + public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException; + public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException; + public abstract Response testClientModel(Client client,SecurityContext securityContext) throws NotFoundException; + public abstract Response testEndpointParameters(BigDecimal number,Double _double,String patternWithoutDelimiter,byte[] _byte,Integer integer,Integer int32,Long int64,Float _float,String string,InputStream binaryInputStream, FormDataContentDisposition binaryDetail,Date date,Date dateTime,String password,String paramCallback,SecurityContext securityContext) throws NotFoundException; + public abstract Response testEnumParameters(List enumHeaderStringArray,String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble,List enumFormStringArray,String enumFormString,SecurityContext securityContext) throws NotFoundException; + public abstract Response testInlineAdditionalProperties(Map requestBody,SecurityContext securityContext) throws NotFoundException; + public abstract Response testJsonFormData(String param,String param2,SecurityContext securityContext) throws NotFoundException; + public abstract Response uploadFileWithRequiredFile(Long petId,InputStream requiredFileInputStream, FormDataContentDisposition requiredFileDetail,String additionalMetadata,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..f2552f7d08c --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -0,0 +1,72 @@ +package org.openapitools.api; + +import org.openapitools.model.*; +import org.openapitools.api.FakeClassnameTestApiService; +import org.openapitools.api.factories.FakeClassnameTestApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import org.openapitools.model.Client; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/fake_classname_test") + + +@io.swagger.annotations.Api(description = "the fake_classname_test API") + +public class FakeClassnameTestApi { + private final FakeClassnameTestApiService delegate; + + public FakeClassnameTestApi(@Context ServletConfig servletContext) { + FakeClassnameTestApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("FakeClassnameTestApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (FakeClassnameTestApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = FakeClassnameTestApiServiceFactory.getFakeClassnameTestApi(); + } + + this.delegate = delegate; + } + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { + @io.swagger.annotations.Authorization(value = "api_key_query") + }, tags={ "fake_classname_tags 123#$%^", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClassname(@ApiParam(value = "client model" ,required=true) @Valid Client client +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testClassname(client,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java new file mode 100644 index 00000000000..d5c2d43a43d --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java @@ -0,0 +1,21 @@ +package org.openapitools.api; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class FakeClassnameTestApiService { + public abstract Response testClassname(Client client,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 00000000000..38d5e782f08 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,69 @@ +package org.openapitools.api; + +import org.openapitools.model.*; +import org.openapitools.api.FooApiService; +import org.openapitools.api.factories.FooApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import org.openapitools.model.InlineResponseDefault; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/foo") + + +@io.swagger.annotations.Api(description = "the foo API") + +public class FooApi { + private final FooApiService delegate; + + public FooApi(@Context ServletConfig servletContext) { + FooApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("FooApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (FooApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = FooApiServiceFactory.getFooApi(); + } + + this.delegate = delegate; + } + + @GET + + + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "", notes = "", response = InlineResponseDefault.class, tags={ }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "response", response = InlineResponseDefault.class) }) + public Response fooGet(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fooGet(securityContext); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java new file mode 100644 index 00000000000..f25c9066056 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java @@ -0,0 +1,21 @@ +package org.openapitools.api; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import org.openapitools.model.InlineResponseDefault; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class FooApiService { + public abstract Response fooGet(SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java index 9a192077229..526df6c1c19 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java @@ -1,6 +1,6 @@ package org.openapitools.api; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { 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 c95d7d206eb..6bfaebc7da2 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 @@ -32,7 +32,7 @@ import javax.validation.Valid; @io.swagger.annotations.Api(description = "the pet API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class PetApi { private final PetApiService delegate; @@ -106,7 +106,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -125,7 +125,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -182,8 +182,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name -,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); @@ -201,7 +201,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail 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 ebef4c84276..ebd89ee5c3a 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 @@ -17,7 +17,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + 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; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java index baf6acac6ce..2c079b00655 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java @@ -31,7 +31,7 @@ import javax.validation.Valid; @io.swagger.annotations.Api(description = "the store API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class StoreApi { private final StoreApiService delegate; @@ -57,7 +57,7 @@ public class StoreApi { } @DELETE - @Path("/order/{orderId}") + @Path("/order/{order_id}") @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) @@ -65,7 +65,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId + public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("order_id") String orderId ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteOrder(orderId,securityContext); @@ -84,7 +84,7 @@ public class StoreApi { return delegate.getInventory(securityContext); } @GET - @Path("/order/{orderId}") + @Path("/order/{order_id}") @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -94,7 +94,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId + public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("order_id") Long orderId ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getOrderById(orderId,securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java index fdcf8c32150..47440abc132 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java @@ -16,7 +16,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public abstract class StoreApiService { public abstract Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException; public abstract Response getInventory(SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java index 4a37c59f65c..36728355897 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java @@ -1,6 +1,6 @@ package org.openapitools.api; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java index 4dc93d626da..49ccb236e96 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java @@ -31,7 +31,7 @@ import javax.validation.Valid; @io.swagger.annotations.Api(description = "the user API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class UserApi { private final UserApiService delegate; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java index 89ce3629726..ce18fdbf88c 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java @@ -16,7 +16,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public abstract class UserApiService { public abstract Response createUser(User user,SecurityContext securityContext) throws NotFoundException; public abstract Response createUsersWithArrayInput(List user,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..0ca045eb604 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,136 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + @JsonProperty("map_property") + private Map mapProperty = null; + + @JsonProperty("map_of_map_property") + private Map> mapOfMapProperty = null; + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @JsonProperty("map_property") + @ApiModelProperty(value = "") + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @JsonProperty("map_of_map_property") + @ApiModelProperty(value = "") + @Valid + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 00000000000..759bcd00559 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,120 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Animal + */ + +public class Animal { + @JsonProperty("className") + private String className; + + @JsonProperty("color") + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @JsonProperty("className") + @ApiModelProperty(required = true, value = "") + @NotNull + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @JsonProperty("color") + @ApiModelProperty(value = "") + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AnimalFarm.java new file mode 100644 index 00000000000..d928eb44271 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..f96168b4fb4 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayOfArrayOfNumberOnly + */ + +public class ArrayOfArrayOfNumberOnly { + @JsonProperty("ArrayArrayNumber") + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @JsonProperty("ArrayArrayNumber") + @ApiModelProperty(value = "") + @Valid + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..279c69dd1dd --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayOfNumberOnly + */ + +public class ArrayOfNumberOnly { + @JsonProperty("ArrayNumber") + private List arrayNumber = null; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @JsonProperty("ArrayNumber") + @ApiModelProperty(value = "") + @Valid + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 00000000000..824d9a8d39c --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,169 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayTest + */ + +public class ArrayTest { + @JsonProperty("array_of_string") + private List arrayOfString = null; + + @JsonProperty("array_array_of_integer") + private List> arrayArrayOfInteger = null; + + @JsonProperty("array_array_of_model") + private List> arrayArrayOfModel = null; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @JsonProperty("array_of_string") + @ApiModelProperty(value = "") + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @JsonProperty("array_array_of_integer") + @ApiModelProperty(value = "") + @Valid + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @JsonProperty("array_array_of_model") + @ApiModelProperty(value = "") + @Valid + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 00000000000..96476aacafc --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,217 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel; + + @JsonProperty("CapitalCamel") + private String capitalCamel; + + @JsonProperty("small_Snake") + private String smallSnake; + + @JsonProperty("Capital_Snake") + private String capitalSnake; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints; + + @JsonProperty("ATT_NAME") + private String ATT_NAME; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @JsonProperty("smallCamel") + @ApiModelProperty(value = "") + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @JsonProperty("CapitalCamel") + @ApiModelProperty(value = "") + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @JsonProperty("small_Snake") + @ApiModelProperty(value = "") + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @JsonProperty("Capital_Snake") + @ApiModelProperty(value = "") + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @JsonProperty("SCA_ETH_Flow_Points") + @ApiModelProperty(value = "") + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @JsonProperty("ATT_NAME") + @ApiModelProperty(value = "Name of the pet ") + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 00000000000..ccab7921e3b --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Cat + */ + +public class Cat extends Animal { + @JsonProperty("declawed") + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @JsonProperty("declawed") + @ApiModelProperty(value = "") + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java index 2786cc540c3..b1e996c5a41 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -22,16 +22,15 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * A category for a pet + * Category */ -@ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -63,8 +62,9 @@ public class Category { * @return name **/ @JsonProperty("name") - @ApiModelProperty(value = "") - + @ApiModelProperty(required = true, value = "") + @NotNull + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 00000000000..538b5bd4e84 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty("_class") + @ApiModelProperty(value = "") + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 00000000000..eb1bc102269 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Client + */ + +public class Client { + @JsonProperty("client") + private String client; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @JsonProperty("client") + @ApiModelProperty(value = "") + + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 00000000000..240145a35e3 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Dog + */ + +public class Dog extends Animal { + @JsonProperty("breed") + private String breed; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @JsonProperty("breed") + @ApiModelProperty(value = "") + + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 00000000000..81f0f17d114 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,190 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * EnumArrays + */ + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String text) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String text) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("array_enum") + private List arrayEnum = null; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @JsonProperty("just_symbol") + @ApiModelProperty(value = "") + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @JsonProperty("array_enum") + @ApiModelProperty(value = "") + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 00000000000..de61df4076b --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 00000000000..7917dffad21 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,323 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OuterEnum; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * EnumTest + */ + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String text) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string") + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String text) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String text) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_number") + private EnumNumberEnum enumNumber; + + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @JsonProperty("enum_string") + @ApiModelProperty(value = "") + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @JsonProperty("enum_string_required") + @ApiModelProperty(required = true, value = "") + @NotNull + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @JsonProperty("enum_integer") + @ApiModelProperty(value = "") + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @JsonProperty("enum_number") + @ApiModelProperty(value = "") + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @JsonProperty("outerEnum") + @ApiModelProperty(value = "") + @Valid + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..12de315baa5 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,127 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @JsonProperty("file") + @ApiModelProperty(value = "") + @Valid + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @JsonProperty("files") + @ApiModelProperty(value = "") + @Valid + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Foo.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 00000000000..df0309709c9 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Foo + */ + +public class Foo { + @JsonProperty("bar") + private String bar = "bar"; + + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + @ApiModelProperty(value = "") + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 00000000000..cbeec51b83b --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,410 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.Date; +import java.util.UUID; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FormatTest + */ + +public class FormatTest { + @JsonProperty("integer") + private Integer integer; + + @JsonProperty("int32") + private Integer int32; + + @JsonProperty("int64") + private Long int64; + + @JsonProperty("number") + private BigDecimal number; + + @JsonProperty("float") + private Float _float; + + @JsonProperty("double") + private Double _double; + + @JsonProperty("string") + private String string; + + @JsonProperty("byte") + private byte[] _byte; + + @JsonProperty("binary") + private File binary; + + @JsonProperty("date") + private Date date; + + @JsonProperty("dateTime") + private Date dateTime; + + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("password") + private String password; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @JsonProperty("integer") + @ApiModelProperty(value = "") + @Min(10) @Max(100) + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @JsonProperty("int32") + @ApiModelProperty(value = "") + @Min(20) @Max(200) + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @JsonProperty("int64") + @ApiModelProperty(value = "") + + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @JsonProperty("number") + @ApiModelProperty(required = true, value = "") + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @JsonProperty("float") + @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @JsonProperty("double") + @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty("string") + @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @JsonProperty("byte") + @ApiModelProperty(required = true, value = "") + @NotNull + + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @JsonProperty("binary") + @ApiModelProperty(value = "") + + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest date(Date date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @JsonProperty("date") + @ApiModelProperty(required = true, value = "") + @NotNull + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty("dateTime") + @ApiModelProperty(value = "") + + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty("uuid") + @ApiModelProperty(value = "") + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty("password") + @ApiModelProperty(required = true, value = "") + @NotNull + @Size(min=10,max=64) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Objects.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..5b4ba5936e4 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,99 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * HasOnlyReadOnly + */ + +public class HasOnlyReadOnly { + @JsonProperty("bar") + private String bar; + + @JsonProperty("foo") + private String foo; + + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + @ApiModelProperty(value = "") + + public String getBar() { + return bar; + } + + /** + * Get foo + * @return foo + **/ + @JsonProperty("foo") + @ApiModelProperty(value = "") + + public String getFoo() { + return foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject.java new file mode 100644 index 00000000000..f42b30fa778 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject + */ + +public class InlineObject { + @JsonProperty("name") + private String name; + + @JsonProperty("status") + private String status; + + public InlineObject name(String name) { + this.name = name; + return this; + } + + /** + * Updated name of the pet + * @return name + **/ + @JsonProperty("name") + @ApiModelProperty(value = "Updated name of the pet") + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public InlineObject status(String status) { + this.status = status; + return this; + } + + /** + * Updated status of the pet + * @return status + **/ + @JsonProperty("status") + @ApiModelProperty(value = "Updated status of the pet") + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.status, inlineObject.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject1.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject1.java new file mode 100644 index 00000000000..87f925ed897 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject1.java @@ -0,0 +1,118 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject1 + */ + +public class InlineObject1 { + @JsonProperty("additionalMetadata") + private String additionalMetadata; + + @JsonProperty("file") + private File file; + + public InlineObject1 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @JsonProperty("additionalMetadata") + @ApiModelProperty(value = "Additional data to pass to server") + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + public InlineObject1 file(File file) { + this.file = file; + return this; + } + + /** + * file to upload + * @return file + **/ + @JsonProperty("file") + @ApiModelProperty(value = "file to upload") + + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject1 inlineObject1 = (InlineObject1) o; + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) && + Objects.equals(this.file, inlineObject1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject1 {\n"); + + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject2.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject2.java new file mode 100644 index 00000000000..8cc26b3bb12 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject2.java @@ -0,0 +1,192 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject2 + */ + +public class InlineObject2 { + /** + * Gets or Sets enumFormStringArray + */ + public enum EnumFormStringArrayEnum { + GREATER_THAN(">"), + + DOLLAR("$"); + + private String value; + + EnumFormStringArrayEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringArrayEnum fromValue(String text) { + for (EnumFormStringArrayEnum b : EnumFormStringArrayEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_form_string_array") + private List enumFormStringArray = null; + + /** + * Form parameter enum test (string) + */ + public enum EnumFormStringEnum { + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumFormStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringEnum fromValue(String text) { + for (EnumFormStringEnum b : EnumFormStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_form_string") + private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; + + public InlineObject2 enumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + return this; + } + + public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumFormStringArrayItem) { + if (this.enumFormStringArray == null) { + this.enumFormStringArray = new ArrayList(); + } + this.enumFormStringArray.add(enumFormStringArrayItem); + return this; + } + + /** + * Form parameter enum test (string array) + * @return enumFormStringArray + **/ + @JsonProperty("enum_form_string_array") + @ApiModelProperty(value = "Form parameter enum test (string array)") + + public List getEnumFormStringArray() { + return enumFormStringArray; + } + + public void setEnumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + } + + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + return this; + } + + /** + * Form parameter enum test (string) + * @return enumFormString + **/ + @JsonProperty("enum_form_string") + @ApiModelProperty(value = "Form parameter enum test (string)") + + public EnumFormStringEnum getEnumFormString() { + return enumFormString; + } + + public void setEnumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject2 inlineObject2 = (InlineObject2) o; + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) && + Objects.equals(this.enumFormString, inlineObject2.enumFormString); + } + + @Override + public int hashCode() { + return Objects.hash(enumFormStringArray, enumFormString); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject2 {\n"); + + sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n"); + sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject3.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject3.java new file mode 100644 index 00000000000..c9d27e8aa64 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject3.java @@ -0,0 +1,433 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.Date; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject3 + */ + +public class InlineObject3 { + @JsonProperty("integer") + private Integer integer; + + @JsonProperty("int32") + private Integer int32; + + @JsonProperty("int64") + private Long int64; + + @JsonProperty("number") + private BigDecimal number; + + @JsonProperty("float") + private Float _float; + + @JsonProperty("double") + private Double _double; + + @JsonProperty("string") + private String string; + + @JsonProperty("pattern_without_delimiter") + private String patternWithoutDelimiter; + + @JsonProperty("byte") + private byte[] _byte; + + @JsonProperty("binary") + private File binary; + + @JsonProperty("date") + private Date date; + + @JsonProperty("dateTime") + private Date dateTime; + + @JsonProperty("password") + private String password; + + @JsonProperty("callback") + private String callback; + + public InlineObject3 integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * None + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @JsonProperty("integer") + @ApiModelProperty(value = "None") + @Min(10) @Max(100) + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public InlineObject3 int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * None + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @JsonProperty("int32") + @ApiModelProperty(value = "None") + @Min(20) @Max(200) + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public InlineObject3 int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * None + * @return int64 + **/ + @JsonProperty("int64") + @ApiModelProperty(value = "None") + + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public InlineObject3 number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * None + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @JsonProperty("number") + @ApiModelProperty(required = true, value = "None") + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public InlineObject3 _float(Float _float) { + this._float = _float; + return this; + } + + /** + * None + * maximum: 987.6 + * @return _float + **/ + @JsonProperty("float") + @ApiModelProperty(value = "None") + @DecimalMax("987.6") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public InlineObject3 _double(Double _double) { + this._double = _double; + return this; + } + + /** + * None + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @JsonProperty("double") + @ApiModelProperty(required = true, value = "None") + @NotNull + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public InlineObject3 string(String string) { + this.string = string; + return this; + } + + /** + * None + * @return string + **/ + @JsonProperty("string") + @ApiModelProperty(value = "None") + @Pattern(regexp="/[a-z]/i") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + + /** + * None + * @return patternWithoutDelimiter + **/ + @JsonProperty("pattern_without_delimiter") + @ApiModelProperty(required = true, value = "None") + @NotNull + @Pattern(regexp="^[A-Z].*") + public String getPatternWithoutDelimiter() { + return patternWithoutDelimiter; + } + + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + } + + public InlineObject3 _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * None + * @return _byte + **/ + @JsonProperty("byte") + @ApiModelProperty(required = true, value = "None") + @NotNull + + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public InlineObject3 binary(File binary) { + this.binary = binary; + return this; + } + + /** + * None + * @return binary + **/ + @JsonProperty("binary") + @ApiModelProperty(value = "None") + + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public InlineObject3 date(Date date) { + this.date = date; + return this; + } + + /** + * None + * @return date + **/ + @JsonProperty("date") + @ApiModelProperty(value = "None") + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public InlineObject3 dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * None + * @return dateTime + **/ + @JsonProperty("dateTime") + @ApiModelProperty(value = "None") + + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public InlineObject3 password(String password) { + this.password = password; + return this; + } + + /** + * None + * @return password + **/ + @JsonProperty("password") + @ApiModelProperty(value = "None") + @Size(min=10,max=64) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public InlineObject3 callback(String callback) { + this.callback = callback; + return this; + } + + /** + * None + * @return callback + **/ + @JsonProperty("callback") + @ApiModelProperty(value = "None") + + public String getCallback() { + return callback; + } + + public void setCallback(String callback) { + this.callback = callback; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject3 inlineObject3 = (InlineObject3) o; + return Objects.equals(this.integer, inlineObject3.integer) && + Objects.equals(this.int32, inlineObject3.int32) && + Objects.equals(this.int64, inlineObject3.int64) && + Objects.equals(this.number, inlineObject3.number) && + Objects.equals(this._float, inlineObject3._float) && + Objects.equals(this._double, inlineObject3._double) && + Objects.equals(this.string, inlineObject3.string) && + Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) && + Objects.equals(this._byte, inlineObject3._byte) && + Objects.equals(this.binary, inlineObject3.binary) && + Objects.equals(this.date, inlineObject3.date) && + Objects.equals(this.dateTime, inlineObject3.dateTime) && + Objects.equals(this.password, inlineObject3.password) && + Objects.equals(this.callback, inlineObject3.callback); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, patternWithoutDelimiter, _byte, binary, date, dateTime, password, callback); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject3 {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" callback: ").append(toIndentedString(callback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject4.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject4.java new file mode 100644 index 00000000000..aecb8aab68f --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject4.java @@ -0,0 +1,119 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject4 + */ + +public class InlineObject4 { + @JsonProperty("param") + private String param; + + @JsonProperty("param2") + private String param2; + + public InlineObject4 param(String param) { + this.param = param; + return this; + } + + /** + * field1 + * @return param + **/ + @JsonProperty("param") + @ApiModelProperty(required = true, value = "field1") + @NotNull + + public String getParam() { + return param; + } + + public void setParam(String param) { + this.param = param; + } + + public InlineObject4 param2(String param2) { + this.param2 = param2; + return this; + } + + /** + * field2 + * @return param2 + **/ + @JsonProperty("param2") + @ApiModelProperty(required = true, value = "field2") + @NotNull + + public String getParam2() { + return param2; + } + + public void setParam2(String param2) { + this.param2 = param2; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject4 inlineObject4 = (InlineObject4) o; + return Objects.equals(this.param, inlineObject4.param) && + Objects.equals(this.param2, inlineObject4.param2); + } + + @Override + public int hashCode() { + return Objects.hash(param, param2); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject4 {\n"); + + sb.append(" param: ").append(toIndentedString(param)).append("\n"); + sb.append(" param2: ").append(toIndentedString(param2)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject5.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject5.java new file mode 100644 index 00000000000..f251f33170f --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineObject5.java @@ -0,0 +1,119 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineObject5 + */ + +public class InlineObject5 { + @JsonProperty("additionalMetadata") + private String additionalMetadata; + + @JsonProperty("requiredFile") + private File requiredFile; + + public InlineObject5 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @JsonProperty("additionalMetadata") + @ApiModelProperty(value = "Additional data to pass to server") + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + public InlineObject5 requiredFile(File requiredFile) { + this.requiredFile = requiredFile; + return this; + } + + /** + * file to upload + * @return requiredFile + **/ + @JsonProperty("requiredFile") + @ApiModelProperty(required = true, value = "file to upload") + @NotNull + + public File getRequiredFile() { + return requiredFile; + } + + public void setRequiredFile(File requiredFile) { + this.requiredFile = requiredFile; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject5 inlineObject5 = (InlineObject5) o; + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) && + Objects.equals(this.requiredFile, inlineObject5.requiredFile); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, requiredFile); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject5 {\n"); + + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineResponseDefault.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineResponseDefault.java new file mode 100644 index 00000000000..5d9826ab0c8 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/InlineResponseDefault.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Foo; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * InlineResponseDefault + */ + +public class InlineResponseDefault { + @JsonProperty("string") + private Foo string = null; + + public InlineResponseDefault string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty("string") + @ApiModelProperty(value = "") + @Valid + public Foo getString() { + return string; + } + + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; + return Objects.equals(this.string, inlineResponseDefault.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineResponseDefault {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 00000000000..549e9303382 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,234 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * MapTest + */ + +public class MapTest { + @JsonProperty("map_map_of_string") + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String text) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("map_of_enum_string") + private Map mapOfEnumString = null; + + @JsonProperty("direct_map") + private Map directMap = null; + + @JsonProperty("indirect_map") + private Map indirectMap = null; + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @JsonProperty("map_map_of_string") + @ApiModelProperty(value = "") + @Valid + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @JsonProperty("map_of_enum_string") + @ApiModelProperty(value = "") + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @JsonProperty("direct_map") + @ApiModelProperty(value = "") + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @JsonProperty("indirect_map") + @ApiModelProperty(value = "") + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..0f291a48039 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("dateTime") + private Date dateTime; + + @JsonProperty("map") + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty("uuid") + @ApiModelProperty(value = "") + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty("dateTime") + @ApiModelProperty(value = "") + + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @JsonProperty("map") + @ApiModelProperty(value = "") + @Valid + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 00000000000..cb0463e72a6 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,118 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response { + @JsonProperty("name") + private Integer name; + + @JsonProperty("class") + private String propertyClass; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty("name") + @ApiModelProperty(value = "") + + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty("class") + @ApiModelProperty(value = "") + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java index 2314bbb1aa3..ee678612d84 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -22,19 +22,18 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * Describes the result of uploading an image resource + * ModelApiResponse */ -@ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 00000000000..aa0c9fd900d --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn { + @JsonProperty("return") + private Integer _return; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @JsonProperty("return") + @ApiModelProperty(value = "") + + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 00000000000..23bd2389f03 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,151 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") + +public class Name { + @JsonProperty("name") + private Integer name; + + @JsonProperty("snake_case") + private Integer snakeCase; + + @JsonProperty("property") + private String property; + + @JsonProperty("123Number") + private Integer _123number; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty("name") + @ApiModelProperty(required = true, value = "") + @NotNull + + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @JsonProperty("snake_case") + @ApiModelProperty(value = "") + + public Integer getSnakeCase() { + return snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @JsonProperty("property") + @ApiModelProperty(value = "") + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123number + * @return _123number + **/ + @JsonProperty("123Number") + @ApiModelProperty(value = "") + + public Integer get123number() { + return _123number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 00000000000..4b622a0187b --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * NumberOnly + */ + +public class NumberOnly { + @JsonProperty("JustNumber") + private BigDecimal justNumber; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @JsonProperty("JustNumber") + @ApiModelProperty(value = "") + @Valid + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java index 3b5b04cbaea..c5387324624 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -24,22 +24,21 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * An order for a pets from the pet store + * Order */ -@ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -75,7 +74,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 00000000000..351583bf105 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber; + + @JsonProperty("my_string") + private String myString; + + @JsonProperty("my_boolean") + private Boolean myBoolean; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @JsonProperty("my_number") + @ApiModelProperty(value = "") + @Valid + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @JsonProperty("my_string") + @ApiModelProperty(value = "") + + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @JsonProperty("my_boolean") + @ApiModelProperty(value = "") + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 00000000000..3c15248e185 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + 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 40c15af5f23..a74c6936d72 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 @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -27,19 +27,18 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * A pet for sale in the pet store + * Pet */ -@ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -81,7 +80,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..a961d7518d3 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,108 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + @JsonProperty("bar") + private String bar; + + @JsonProperty("baz") + private String baz; + + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + @ApiModelProperty(value = "") + + public String getBar() { + return bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @JsonProperty("baz") + @ApiModelProperty(value = "") + + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 00000000000..e32f542d71d --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * SpecialModelName + */ + +public class SpecialModelName { + @JsonProperty("$special[property.name]") + private Long $specialPropertyName; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @JsonProperty("$special[property.name]") + @ApiModelProperty(value = "") + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/StringBooleanMap.java new file mode 100644 index 00000000000..82f8116bb1f --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * StringBooleanMap + */ + +public class StringBooleanMap extends HashMap { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringBooleanMap {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java index 0e3d096b04f..d60cad5c167 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -22,16 +22,15 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * A tag for a pet + * Tag */ -@ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java index 8e573622cde..e6a336773f0 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java @@ -1,6 +1,6 @@ /* * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * @@ -22,34 +22,33 @@ import javax.validation.constraints.*; import javax.validation.Valid; /** - * A User who is purchasing from the pet store + * User */ -@ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..21281d8d8a4 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.AnotherFakeApiService; +import org.openapitools.api.impl.AnotherFakeApiServiceImpl; + + +public class AnotherFakeApiServiceFactory { + private final static AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java new file mode 100644 index 00000000000..6b5746c6e8a --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FakeApiService; +import org.openapitools.api.impl.FakeApiServiceImpl; + + +public class FakeApiServiceFactory { + private final static FakeApiService service = new FakeApiServiceImpl(); + + public static FakeApiService getFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java new file mode 100644 index 00000000000..3c866f7e478 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FakeClassnameTestApiService; +import org.openapitools.api.impl.FakeClassnameTestApiServiceImpl; + + +public class FakeClassnameTestApiServiceFactory { + private final static FakeClassnameTestApiService service = new FakeClassnameTestApiServiceImpl(); + + public static FakeClassnameTestApiService getFakeClassnameTestApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java new file mode 100644 index 00000000000..d3740d058d0 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FooApiService; +import org.openapitools.api.impl.FooApiServiceImpl; + + +public class FooApiServiceFactory { + private final static FooApiService service = new FooApiServiceImpl(); + + public static FooApiService getFooApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java index 2c96b853f99..c292d9111ee 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.PetApiService; import org.openapitools.api.impl.PetApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class PetApiServiceFactory { private final static PetApiService service = new PetApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java index f08e7e02c25..0a145377ade 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.StoreApiService; import org.openapitools.api.impl.StoreApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class StoreApiServiceFactory { private final static StoreApiService service = new StoreApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java index cd4956f5e14..6376e5732cf 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.UserApiService; import org.openapitools.api.impl.UserApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class UserApiServiceFactory { private final static UserApiService service = new UserApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..05e89018227 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,25 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response call123testSpecialTags(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java new file mode 100644 index 00000000000..18ba5cd2bd7 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -0,0 +1,88 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import java.math.BigDecimal; +import org.openapitools.model.Client; +import java.util.Date; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterCompositeSerialize(OuterComposite outerComposite, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterNumberSerialize(BigDecimal body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterStringSerialize(String body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithQueryParams( @NotNull String query, User user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testClientModel(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, InputStream binaryInputStream, FormDataContentDisposition binaryDetail, Date date, Date dateTime, String password, String paramCallback, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testInlineAdditionalProperties(Map requestBody, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testJsonFormData(String param, String param2, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFileWithRequiredFile(Long petId, InputStream requiredFileInputStream, FormDataContentDisposition requiredFileDetail, String additionalMetadata, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java new file mode 100644 index 00000000000..8e5ee58fd96 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java @@ -0,0 +1,25 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class FakeClassnameTestApiServiceImpl extends FakeClassnameTestApiService { + @Override + public Response testClassname(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java new file mode 100644 index 00000000000..7c891c1514f --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java @@ -0,0 +1,25 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.*; + +import org.openapitools.model.InlineResponseDefault; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class FooApiServiceImpl extends FooApiService { + @Override + public Response fooGet(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} 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 47882fec694..366b2e4e133 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 @@ -17,7 +17,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class PetApiServiceImpl extends PetApiService { @Override public Response addPet(Pet pet, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java index b22ee3b8dd0..18c2ec5ecdd 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java @@ -16,7 +16,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class StoreApiServiceImpl extends StoreApiService { @Override public Response deleteOrder(String orderId, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 468ea57b2b0..ef7366a6626 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -16,7 +16,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") + public class UserApiServiceImpl extends UserApiService { @Override public Response createUser(User user, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java index 4c665566958..e5853115ab0 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Category implements Serializable { private @Valid Long id; - private @Valid String name; + private @Valid String name = "default-name"; /** **/ @@ -44,8 +44,9 @@ public class Category implements Serializable { } - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") @JsonProperty("name") + @NotNull public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index dbeef1c2a38..35c5a92c1dd 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1101,14 +1101,17 @@ components: schemas: Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1595,7 +1598,7 @@ components: name: doggie id: 0 category: - name: name + name: default-name id: 6 tags: - name: name diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java index 4c665566958..e5853115ab0 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Category implements Serializable { private @Valid Long id; - private @Valid String name; + private @Valid String name = "default-name"; /** **/ @@ -44,8 +44,9 @@ public class Category implements Serializable { } - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") @JsonProperty("name") + @NotNull public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index dbeef1c2a38..35c5a92c1dd 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1101,14 +1101,17 @@ components: schemas: Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1595,7 +1598,7 @@ components: name: doggie id: 0 category: - name: name + name: default-name id: 6 tags: - name: name diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java index b94a66a3668..b1e996c5a41 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -62,8 +62,9 @@ public class Category { * @return name **/ @JsonProperty("name") - @ApiModelProperty(value = "") - + @ApiModelProperty(required = true, value = "") + @NotNull + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java index b94a66a3668..b1e996c5a41 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -62,8 +62,9 @@ public class Category { * @return name **/ @JsonProperty("name") - @ApiModelProperty(value = "") - + @ApiModelProperty(required = true, value = "") + @NotNull + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java index b94a66a3668..b1e996c5a41 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -62,8 +62,9 @@ public class Category { * @return name **/ @JsonProperty("name") - @ApiModelProperty(value = "") - + @ApiModelProperty(required = true, value = "") + @NotNull + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java index b94a66a3668..b1e996c5a41 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java @@ -30,7 +30,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -62,8 +62,9 @@ public class Category { * @return name **/ @JsonProperty("name") - @ApiModelProperty(value = "") - + @ApiModelProperty(required = true, value = "") + @NotNull + public String getName() { return name; } diff --git a/samples/server/petstore/php-ze-ph/src/App/DTO/Category.php b/samples/server/petstore/php-ze-ph/src/App/DTO/Category.php index 67f1b97ec3c..6634e8f2b42 100644 --- a/samples/server/petstore/php-ze-ph/src/App/DTO/Category.php +++ b/samples/server/petstore/php-ze-ph/src/App/DTO/Category.php @@ -15,7 +15,7 @@ class Category */ public $id; /** - * @DTA\Data(field="name", nullable=true) + * @DTA\Data(field="name") * @DTA\Validator(name="Type", options={"type":"string"}) * @var string */ diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java index de13b9cae5b..3183019a47a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java @@ -88,7 +88,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -120,7 +120,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -150,7 +150,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java index e5721a36ef7..0b5ab7f549e 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java @@ -86,7 +86,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -116,7 +116,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -144,7 +144,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java index 049bfc7c538..edd66c31823 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java @@ -46,7 +46,7 @@ public class PetApiController implements PetApi { public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -61,7 +61,7 @@ public class PetApiController implements PetApi { public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -76,7 +76,7 @@ public class PetApiController implements PetApi { public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java index b71655507f5..310e3b2e45f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java @@ -46,7 +46,7 @@ public class PetApiController implements PetApi { public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -61,7 +61,7 @@ public class PetApiController implements PetApi { public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -76,7 +76,7 @@ public class PetApiController implements PetApi { public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java index 65c95bf1c1e..32dd72c3de0 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -49,7 +49,7 @@ public interface PetApiDelegate { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -69,7 +69,7 @@ public interface PetApiDelegate { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -89,7 +89,7 @@ public interface PetApiDelegate { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java index 8c5842b581e..5128e58f629 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java @@ -93,7 +93,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -125,7 +125,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -155,7 +155,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java index 1084c1bfe49..1606fac281d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -60,7 +60,7 @@ public interface PetApiDelegate { Mono result = Mono.empty(); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -81,7 +81,7 @@ public interface PetApiDelegate { Mono result = Mono.empty(); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -102,7 +102,7 @@ public interface PetApiDelegate { Mono result = Mono.empty(); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index 66e8f0dcd22..31ad15f3a9f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1158,14 +1158,17 @@ components: schemas: Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1652,7 +1655,7 @@ components: name: doggie id: 0 category: - name: name + name: default-name id: 6 tags: - name: name diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java index 73ed9053355..f53058a212d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java @@ -86,7 +86,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -116,7 +116,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -144,7 +144,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java index e5721a36ef7..0b5ab7f549e 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java @@ -86,7 +86,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -116,7 +116,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { @@ -144,7 +144,7 @@ public interface PetApi { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java index ab96fdce16a..540f07d205a 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java @@ -17,7 +17,7 @@ public class Category { private Long id; @JsonProperty("name") - private String name; + private String name = "default-name"; public Category id(Long id) { this.id = id; @@ -48,7 +48,8 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") + @NotNull public String getName() { From e06665f368bcf2cfc246890ddcba1b7e4adbb8ab Mon Sep 17 00:00:00 2001 From: john lilley Date: Tue, 23 Oct 2018 02:52:36 -0600 Subject: [PATCH 18/35] Set isModel property (#1275) * Set isModel property * Replace tab characters --- .../java/org/openapitools/codegen/CodegenParameter.java | 7 ++++++- .../java/org/openapitools/codegen/CodegenProperty.java | 7 ++++++- .../main/java/org/openapitools/codegen/DefaultCodegen.java | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index d290aa5c6ab..661f5e2dcf5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -25,7 +25,7 @@ import java.util.Map; public class CodegenParameter { public boolean isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, - secondaryParam, isCollectionFormatMulti, isPrimitiveType; + secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel; public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName; @@ -110,6 +110,7 @@ public class CodegenParameter { output.collectionFormat = this.collectionFormat; output.isCollectionFormatMulti = this.isCollectionFormatMulti; output.isPrimitiveType = this.isPrimitiveType; + output.isModel = this.isModel; output.description = this.description; output.unescapedDescription = this.unescapedDescription; output.baseType = this.baseType; @@ -201,6 +202,8 @@ public class CodegenParameter { return false; if (isPrimitiveType != that.isPrimitiveType) return false; + if (isModel != that.isModel) + return false; if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null) return false; if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null) @@ -312,6 +315,7 @@ public class CodegenParameter { result = 31 * result + (secondaryParam ? 13:31); result = 31 * result + (isCollectionFormatMulti ? 13:31); result = 31 * result + (isPrimitiveType ? 13:31); + result = 31 * result + (isModel ? 13:31); result = 31 * result + (baseName != null ? baseName.hashCode() : 0); result = 31 * result + (paramName != null ? paramName.hashCode() : 0); result = 31 * result + (dataType != null ? dataType.hashCode() : 0); @@ -378,6 +382,7 @@ public class CodegenParameter { ", secondaryParam=" + secondaryParam + ", isCollectionFormatMulti=" + isCollectionFormatMulti + ", isPrimitiveType=" + isPrimitiveType + + ", isModel=" + isModel + ", baseName='" + baseName + '\'' + ", paramName='" + paramName + '\'' + ", dataType='" + dataType + '\'' + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index de026b2d3e0..fd3e27988ec 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -55,7 +55,7 @@ public class CodegenProperty implements Cloneable { public boolean exclusiveMaximum; public boolean hasMore, required, secondaryParam; public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly - public boolean isPrimitiveType, isContainer, isNotContainer; + public boolean isPrimitiveType, isModel, isContainer, isNotContainer; public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid; public boolean isListContainer, isMapContainer; public boolean isEnum; @@ -438,6 +438,7 @@ public class CodegenProperty implements Cloneable { result = prime * result + (isEnum ? 1231 : 1237); result = prime * result + ((isNotContainer ? 13:31)); result = prime * result + ((isPrimitiveType ? 13:31)); + result = prime * result + ((isModel ? 13:31)); result = prime * result + ((isReadOnly ? 13:31)); result = prime * result + ((isWriteOnly ? 13:31)); result = prime * result + ((isNullable ? 13:31)); @@ -579,6 +580,9 @@ public class CodegenProperty implements Cloneable { if (this.isPrimitiveType != other.isPrimitiveType) { return false; } + if (this.isModel != other.isModel) { + return false; + } if (this.isContainer != other.isContainer) { return false; } @@ -759,6 +763,7 @@ public class CodegenProperty implements Cloneable { ", secondaryParam=" + secondaryParam + ", hasMoreNonReadOnly=" + hasMoreNonReadOnly + ", isPrimitiveType=" + isPrimitiveType + + ", isModel=" + isModel + ", isContainer=" + isContainer + ", isNotContainer=" + isNotContainer + ", isString=" + isString + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 3e5cef43850..b7d74c78ec4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2175,6 +2175,7 @@ public class DefaultCodegen implements CodegenConfig { property.isPrimitiveType = true; } else { property.complexType = property.baseType; + property.isModel = true; } } @@ -4515,6 +4516,9 @@ public class DefaultCodegen implements CodegenConfig { schema.setName(name); codegenModel = fromModel(name, schema, schemas); } + if (codegenModel != null) { + codegenParameter.isModel = true; + } if (codegenModel != null && !codegenModel.emptyVars) { if (StringUtils.isEmpty(bodyParameterName)) { From e782001eb9fa678bcd56129d13e63406961d0de3 Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Tue, 23 Oct 2018 10:58:33 +0200 Subject: [PATCH 19/35] [elm] Add support for `additionalProperties` (#1262) Fixes #1140. --- .../src/main/resources/elm/fieldDecoder.mustache | 2 +- .../src/main/resources/elm/fieldEncoder.mustache | 2 +- .../openapi-generator/src/main/resources/elm/model.mustache | 3 ++- .../src/main/resources/elm/modelTypeAlias.mustache | 2 +- samples/client/petstore/elm-0.18/.openapi-generator/VERSION | 2 +- samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm | 1 + samples/client/petstore/elm-0.18/src/Data/Category.elm | 1 + samples/client/petstore/elm-0.18/src/Data/Order_.elm | 1 + samples/client/petstore/elm-0.18/src/Data/Pet.elm | 1 + samples/client/petstore/elm-0.18/src/Data/Tag.elm | 1 + samples/client/petstore/elm-0.18/src/Data/User.elm | 1 + samples/client/petstore/elm/.openapi-generator/VERSION | 2 +- samples/client/petstore/elm/src/Data/ApiResponse.elm | 1 + samples/client/petstore/elm/src/Data/Category.elm | 1 + samples/client/petstore/elm/src/Data/Order_.elm | 1 + samples/client/petstore/elm/src/Data/Pet.elm | 1 + samples/client/petstore/elm/src/Data/Tag.elm | 1 + samples/client/petstore/elm/src/Data/User.elm | 1 + 18 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache b/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache index 6f7db61ddbd..c40e55b7390 100644 --- a/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache @@ -1 +1 @@ -{{#required}}required{{/required}}{{^required}}optional{{/required}} "{{baseName}}" {{^required}}(Decode.nullable {{/required}}{{#isContainer}}(Decode.list {{/isContainer}}{{vendorExtensions.elmDecoder}}{{#isContainer}}){{/isContainer}}{{^required}}){{/required}}{{^required}} {{{defaultValue}}}{{/required}} \ No newline at end of file +{{#required}}required{{/required}}{{^required}}optional{{/required}} "{{baseName}}" {{^required}}(Decode.nullable {{/required}}{{#isMapContainer}}(Decode.dict {{/isMapContainer}}{{#isListContainer}}(Decode.list {{/isListContainer}}{{vendorExtensions.elmDecoder}}{{#isContainer}}){{/isContainer}}{{^required}}){{/required}}{{^required}} {{{defaultValue}}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache b/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache index df4dc919d6e..58bd131abbf 100644 --- a/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache @@ -1 +1 @@ -( "{{baseName}}", {{#discriminatorValue}}Encode.string "{{discriminatorValue}}"{{/discriminatorValue}}{{^discriminatorValue}}{{^required}}Maybe.withDefault Encode.null (Maybe.map {{/required}}{{#isContainer}}(Encode.list {{#isElm018}}<< List.map {{/isElm018}}{{/isContainer}}{{vendorExtensions.elmEncoder}}{{#isContainer}}){{/isContainer}} model.{{name}}{{^required}}){{/required}}{{/discriminatorValue}} ) \ No newline at end of file +( "{{baseName}}", {{#discriminatorValue}}Encode.string "{{discriminatorValue}}"{{/discriminatorValue}}{{^discriminatorValue}}{{^required}}Maybe.withDefault Encode.null (Maybe.map {{/required}}{{#isMapContainer}}(Encode.dict identity {{/isMapContainer}}{{#isListContainer}}(Encode.list {{#isElm018}}<< List.map {{/isElm018}}{{/isListContainer}}{{vendorExtensions.elmEncoder}}{{#isContainer}}){{/isContainer}} model.{{name}}{{^required}}){{/required}}{{/discriminatorValue}} ) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/model.mustache b/modules/openapi-generator/src/main/resources/elm/model.mustache index 42fa46711d9..4fef4dd19d5 100644 --- a/modules/openapi-generator/src/main/resources/elm/model.mustache +++ b/modules/openapi-generator/src/main/resources/elm/model.mustache @@ -2,7 +2,8 @@ module Data.{{classname}} exposing ({{#models}}{{#model}}{{classname}}{{#hasChildren}}(..){{/hasChildren}}{{#isEnum}}(..){{/isEnum}}{{^isEnum}}{{#vars}}{{#isEnum}}, {{vendorExtensions.elmUnionType}}(..){{/isEnum}}{{/vars}}{{/isEnum}}, decoder, encoder{{/model}}{{/models}}) -{{>imports}}import Json.Decode as Decode exposing (Decoder) +{{>imports}}import Dict exposing (Dict) +import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing ({{#isElm018}}decode, {{/isElm018}}optional, required) import Json.Encode as Encode {{#models}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache index 6063ffe8f4b..1a334177900 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache @@ -1,5 +1,5 @@ type alias {{classname}} = - { {{#allVars}}{{^-first}} , {{/-first}}{{name}} : {{^required}}Maybe {{#isContainer}}({{/isContainer}}{{/required}}{{#isContainer}}List {{/isContainer}}{{#isEnum}}{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{dataType}}{{/isEnum}}{{^required}}{{#isContainer}}){{/isContainer}}{{/required}} + { {{#allVars}}{{^-first}} , {{/-first}}{{name}} : {{^required}}Maybe {{#isContainer}}({{/isContainer}}{{/required}}{{#isMapContainer}}Dict String {{/isMapContainer}}{{#isListContainer}}List {{/isListContainer}}{{#isEnum}}{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{dataType}}{{/isEnum}}{{^required}}{{#isContainer}}){{/isContainer}}{{/required}} {{/allVars}} } {{#vars}} {{#isEnum}} diff --git a/samples/client/petstore/elm-0.18/.openapi-generator/VERSION b/samples/client/petstore/elm-0.18/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/elm-0.18/.openapi-generator/VERSION +++ b/samples/client/petstore/elm-0.18/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm b/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm index 36006df2fae..6aa2e31db61 100644 --- a/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm +++ b/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm @@ -12,6 +12,7 @@ module Data.ApiResponse exposing (ApiResponse, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm-0.18/src/Data/Category.elm b/samples/client/petstore/elm-0.18/src/Data/Category.elm index 38144b5c5cb..044565a4c58 100644 --- a/samples/client/petstore/elm-0.18/src/Data/Category.elm +++ b/samples/client/petstore/elm-0.18/src/Data/Category.elm @@ -12,6 +12,7 @@ module Data.Category exposing (Category, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm-0.18/src/Data/Order_.elm b/samples/client/petstore/elm-0.18/src/Data/Order_.elm index b69e761b24f..6b850b0adfb 100644 --- a/samples/client/petstore/elm-0.18/src/Data/Order_.elm +++ b/samples/client/petstore/elm-0.18/src/Data/Order_.elm @@ -13,6 +13,7 @@ module Data.Order_ exposing (Order_, Status(..), decoder, encoder) import DateTime exposing (DateTime) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm-0.18/src/Data/Pet.elm b/samples/client/petstore/elm-0.18/src/Data/Pet.elm index 752126f0293..48814249c01 100644 --- a/samples/client/petstore/elm-0.18/src/Data/Pet.elm +++ b/samples/client/petstore/elm-0.18/src/Data/Pet.elm @@ -14,6 +14,7 @@ module Data.Pet exposing (Pet, Status(..), decoder, encoder) import Data.Category as Category exposing (Category) import Data.Tag as Tag exposing (Tag) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm-0.18/src/Data/Tag.elm b/samples/client/petstore/elm-0.18/src/Data/Tag.elm index 906e6f7286f..bb6f6b7c9e4 100644 --- a/samples/client/petstore/elm-0.18/src/Data/Tag.elm +++ b/samples/client/petstore/elm-0.18/src/Data/Tag.elm @@ -12,6 +12,7 @@ module Data.Tag exposing (Tag, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm-0.18/src/Data/User.elm b/samples/client/petstore/elm-0.18/src/Data/User.elm index 1d8b44b4b96..fadf78d975f 100644 --- a/samples/client/petstore/elm-0.18/src/Data/User.elm +++ b/samples/client/petstore/elm-0.18/src/Data/User.elm @@ -12,6 +12,7 @@ module Data.User exposing (User, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/.openapi-generator/VERSION b/samples/client/petstore/elm/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/elm/.openapi-generator/VERSION +++ b/samples/client/petstore/elm/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/elm/src/Data/ApiResponse.elm b/samples/client/petstore/elm/src/Data/ApiResponse.elm index 2227c89ad88..c8a346ff56d 100644 --- a/samples/client/petstore/elm/src/Data/ApiResponse.elm +++ b/samples/client/petstore/elm/src/Data/ApiResponse.elm @@ -12,6 +12,7 @@ module Data.ApiResponse exposing (ApiResponse, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/src/Data/Category.elm b/samples/client/petstore/elm/src/Data/Category.elm index b927627fe70..5ba513b1fac 100644 --- a/samples/client/petstore/elm/src/Data/Category.elm +++ b/samples/client/petstore/elm/src/Data/Category.elm @@ -12,6 +12,7 @@ module Data.Category exposing (Category, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/src/Data/Order_.elm b/samples/client/petstore/elm/src/Data/Order_.elm index 45d086df717..b09d247d86f 100644 --- a/samples/client/petstore/elm/src/Data/Order_.elm +++ b/samples/client/petstore/elm/src/Data/Order_.elm @@ -13,6 +13,7 @@ module Data.Order_ exposing (Order_, Status(..), decoder, encoder) import DateTime exposing (DateTime) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/src/Data/Pet.elm b/samples/client/petstore/elm/src/Data/Pet.elm index ed15ad08d2b..68b5478a1ca 100644 --- a/samples/client/petstore/elm/src/Data/Pet.elm +++ b/samples/client/petstore/elm/src/Data/Pet.elm @@ -14,6 +14,7 @@ module Data.Pet exposing (Pet, Status(..), decoder, encoder) import Data.Category as Category exposing (Category) import Data.Tag as Tag exposing (Tag) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/src/Data/Tag.elm b/samples/client/petstore/elm/src/Data/Tag.elm index c514abe1429..c55e7063579 100644 --- a/samples/client/petstore/elm/src/Data/Tag.elm +++ b/samples/client/petstore/elm/src/Data/Tag.elm @@ -12,6 +12,7 @@ module Data.Tag exposing (Tag, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode diff --git a/samples/client/petstore/elm/src/Data/User.elm b/samples/client/petstore/elm/src/Data/User.elm index a6213937f52..827c4ad4180 100644 --- a/samples/client/petstore/elm/src/Data/User.elm +++ b/samples/client/petstore/elm/src/Data/User.elm @@ -12,6 +12,7 @@ module Data.User exposing (User, decoder, encoder) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode From 0001682a08f6f3c86e446119024d15fce1f330cb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 23 Oct 2018 16:59:32 +0800 Subject: [PATCH 20/35] Add file post-processing support for Java generators (#1052) * add clang format support for java * rename java env variable * fix export command --- .../languages/AbstractJavaCodegen.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 595df4ebd76..c119400dbbc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -27,6 +27,7 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.parser.util.SchemaTypeUtil; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; @@ -212,6 +213,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); + } + if (additionalProperties.containsKey(SUPPORT_JAVA6)) { this.setSupportJava6(Boolean.valueOf(additionalProperties.get(SUPPORT_JAVA6).toString())); } @@ -226,7 +231,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code this.setBooleanGetterPrefix(additionalProperties.get(BOOLEAN_GETTER_PREFIX).toString()); } additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix); - if (additionalProperties.containsKey(USE_NULL_FOR_UNKNOWN_ENUM_VALUE)) { this.setUseNullForUnknownEnumValue(Boolean.valueOf(additionalProperties.get(USE_NULL_FOR_UNKNOWN_ENUM_VALUE).toString())); } @@ -1382,6 +1386,35 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return tag; } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String javaPostProcessFile = System.getenv("JAVA_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(javaPostProcessFile)) { + return; // skip if JAVA_POST_PROCESS_FILE env variable is not defined + } + + // only process files with hs extension + if ("java".equals(FilenameUtils.getExtension(file.toString()))) { + String command = javaPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + int exitValue = p.exitValue(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + public void setParentGroupId(final String parentGroupId) { this.parentGroupId = parentGroupId; } From 8455dfe75d54d512596c556d07898376231fa2fb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 23 Oct 2018 18:21:25 +0800 Subject: [PATCH 21/35] update petstore samples --- .../src/Org.OpenAPITools/Api/AnotherFakeApi.cs | 11 +++++++++++ .../OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs | 11 +++++++++++ .../Org.OpenAPITools/Api/FakeClassnameTags123Api.cs | 11 +++++++++++ .../OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 11 +++++++++++ .../OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs | 11 +++++++++++ .../OpenAPIClientNet35/.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNet35/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Api/AnotherFakeApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/FakeApi.cs | 11 +++++++++++ .../Org.OpenAPITools/Api/FakeClassnameTags123Api.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/UserApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../OpenAPIClientNet40/.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNet40/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Api/AnotherFakeApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/FakeApi.cs | 11 +++++++++++ .../Org.OpenAPITools/Api/FakeClassnameTags123Api.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/UserApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNetStandard/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Api/AnotherFakeApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/FakeApi.cs | 11 +++++++++++ .../Org.OpenAPITools/Api/FakeClassnameTags123Api.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/UserApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../.openapi-generator/VERSION | 2 +- .../OpenAPIClientWithPropertyChanged/docs/MapTest.md | 2 +- .../src/Org.OpenAPITools/Api/AnotherFakeApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/FakeApi.cs | 11 +++++++++++ .../Org.OpenAPITools/Api/FakeClassnameTags123Api.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Api/UserApi.cs | 11 +++++++++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- 42 files changed, 354 insertions(+), 24 deletions(-) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index aacccf92ca5..cf759d5e82c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public AnotherFakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index 60e219ead9d..6d0928a226a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -597,6 +597,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index cba038ef133..07156e17824 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeClassnameTags123Api() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs index 2fb6528b32e..8f2f2105e2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs @@ -453,6 +453,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public PetApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs index d03577102bf..4902eb5b1af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs @@ -211,6 +211,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public StoreApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs index 868ca751648..0eba85ddf63 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs @@ -387,6 +387,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public UserApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION index 6d94c9c2e12..f4cb97d56ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 193c4907a1e..65d361bc200 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -66,6 +66,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public AnotherFakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs index 20430b4bbdb..ed151e1bc20 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs @@ -320,6 +320,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index db256a41861..63f51ab5875 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -66,6 +66,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeClassnameTags123Api() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs index 6ec963b56ee..1c0444f8bb3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs @@ -248,6 +248,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public PetApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/StoreApi.cs index bf73f16648a..778cc6a6399 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/StoreApi.cs @@ -127,6 +127,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public StoreApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/UserApi.cs index 4c5f2a4ef03..c746905213b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/UserApi.cs @@ -215,6 +215,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public UserApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs index b9ad7659bcb..bc7166dfbfd 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION index 6d94c9c2e12..f4cb97d56ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 71bcd84a663..dd32c4300ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -66,6 +66,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public AnotherFakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs index c2f338c3bb7..765a1444172 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs @@ -320,6 +320,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index b947e633b5f..99c32e13e11 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -66,6 +66,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeClassnameTags123Api() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs index ca532940cf0..1c596393525 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs @@ -248,6 +248,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public PetApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/StoreApi.cs index c318ec0d073..e45658963ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/StoreApi.cs @@ -127,6 +127,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public StoreApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/UserApi.cs index 9cd5eff5ce0..62f1c2181ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/UserApi.cs @@ -215,6 +215,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public UserApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs index 1c5bfa70198..3f44bcf22ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION index 6d94c9c2e12..f4cb97d56ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 57dcf5ca7b3..8da2f97f375 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public AnotherFakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs index da68811f95a..95cb32fd782 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs @@ -597,6 +597,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 56e8adf1933..f73a932acde 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeClassnameTags123Api() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs index e07717ae436..c6c1644b386 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs @@ -453,6 +453,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public PetApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/StoreApi.cs index d8184086b8d..851c41d3a94 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/StoreApi.cs @@ -211,6 +211,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public StoreApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/UserApi.cs index 3d32cf792a2..b22ab90c883 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/UserApi.cs @@ -387,6 +387,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public UserApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs index 18ccbc3ba9b..8a85cf487f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs @@ -61,7 +61,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -86,7 +86,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -151,8 +151,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION index 6d94c9c2e12..f4cb97d56ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, bool?>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index aacccf92ca5..cf759d5e82c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public AnotherFakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs index 60e219ead9d..6d0928a226a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs @@ -597,6 +597,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index cba038ef133..07156e17824 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -89,6 +89,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public FakeClassnameTags123Api() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs index 2fb6528b32e..8f2f2105e2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs @@ -453,6 +453,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public PetApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/StoreApi.cs index d03577102bf..4902eb5b1af 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/StoreApi.cs @@ -211,6 +211,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public StoreApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/UserApi.cs index 868ca751648..0eba85ddf63 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/UserApi.cs @@ -387,6 +387,17 @@ namespace Org.OpenAPITools.Api ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } + /// + /// Initializes a new instance of the class + /// + /// + public UserApi() + { + this.Configuration = Org.OpenAPITools.Client.Configuration.Default; + + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + /// /// Initializes a new instance of the class /// using Configuration object diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs index ddaac33ee49..c1faecd1f20 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs @@ -66,7 +66,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -156,8 +156,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } From 258de8909d229e737c82f1ccb022447c18b29f1b Mon Sep 17 00:00:00 2001 From: mwoodland Date: Tue, 23 Oct 2018 15:56:03 +0100 Subject: [PATCH 22/35] =?UTF-8?q?Add=20support=20for=20using=20Spring=20HA?= =?UTF-8?q?TEOAS=20to=20add=20links=20in=20the=20spring=20gener=E2=80=A6?= =?UTF-8?q?=20(#1130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for using Spring HATEOAS to add links in the spring generator. * Ensure that Spring HATEOAS links appear last in the JSON serialisation of objects. * A couple of changes following code review: 1. Make sure the @JsonPropertyOrder annotation is only used when the jackson library is being used since it's a part of the jackson library. 2. Make sure to include the Spring HATEOAS dependency in the pom file for the spring-cloud and spring-mvc generators when the hateoas option is enabled. * Don't order the json properties since there's no requirement for the links to be last. * Remove unnecessary import. --- docs/generators/spring.md | 3 +++ .../openapitools/codegen/languages/SpringCodegen.java | 11 +++++++++++ .../JavaSpring/libraries/spring-boot/pom.mustache | 7 +++++++ .../JavaSpring/libraries/spring-cloud/pom.mustache | 7 +++++++ .../JavaSpring/libraries/spring-mvc/pom.mustache | 8 ++++++++ .../src/main/resources/JavaSpring/model.mustache | 5 +++++ .../src/main/resources/JavaSpring/pojo.mustache | 2 +- 7 files changed, 42 insertions(+), 1 deletion(-) diff --git a/docs/generators/spring.md b/docs/generators/spring.md index ab0e1ad15a6..7a3d7bf0bb7 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -164,6 +164,9 @@ CONFIG OPTIONS for spring useOptional Use Optional container for optional parameters (Default: false) + hateoas + Use Spring HATEOAS library to allow adding HATEOAS links (Default: false) + library library template (sub-template) to use (Default: spring-boot) spring-boot - Spring-boot Server application using the SpringFox integration. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 78b7075c667..d5c420154db 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -74,6 +74,7 @@ public class SpringCodegen extends AbstractJavaCodegen public static final String IMPLICIT_HEADERS = "implicitHeaders"; public static final String OPENAPI_DOCKET_CONFIG = "swaggerDocketConfig"; public static final String API_FIRST = "apiFirst"; + public static final String HATEOAS = "hateoas"; protected String title = "OpenAPI Spring"; protected String configPackage = "org.openapitools.configuration"; @@ -93,6 +94,7 @@ public class SpringCodegen extends AbstractJavaCodegen protected boolean apiFirst = false; protected boolean useOptional = false; protected boolean virtualService = false; + protected boolean hateoas = false; public SpringCodegen() { super(); @@ -124,6 +126,7 @@ public class SpringCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(OPENAPI_DOCKET_CONFIG, "Generate Spring OpenAPI Docket configuration class.", openapiDocketConfig)); cliOptions.add(CliOption.newBoolean(API_FIRST, "Generate the API from the OAI spec at server compile time (API first approach)", apiFirst)); cliOptions.add(CliOption.newBoolean(USE_OPTIONAL,"Use Optional container for optional parameters", useOptional)); + cliOptions.add(CliOption.newBoolean(HATEOAS, "Use Spring HATEOAS library to allow adding HATEOAS links", hateoas)); supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application using the SpringFox integration."); supportedLibraries.put(SPRING_MVC_LIBRARY, "Spring-MVC Server application using the SpringFox integration."); @@ -260,6 +263,10 @@ public class SpringCodegen extends AbstractJavaCodegen if (additionalProperties.containsKey(API_FIRST)) { this.setApiFirst(Boolean.valueOf(additionalProperties.get(API_FIRST).toString())); } + + if (additionalProperties.containsKey(HATEOAS)) { + this.setHateoas(Boolean.valueOf(additionalProperties.get(HATEOAS).toString())); + } typeMapping.put("file", "Resource"); importMapping.put("Resource", "org.springframework.core.io.Resource"); @@ -700,6 +707,10 @@ public class SpringCodegen extends AbstractJavaCodegen public void setApiFirst(boolean apiFirst) { this.apiFirst = apiFirst; } + + public void setHateoas(boolean hateoas) { + this.hateoas = hateoas; + } @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache index 555896e60e3..18cd1df2ce5 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache @@ -164,5 +164,12 @@ {{/virtualService}} +{{#hateoas}} + + + org.springframework.boot + spring-boot-starter-hateoas + +{{/hateoas}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache index 7001f567571..4ccbbbb3a80 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache @@ -86,5 +86,12 @@ spring-boot-starter-test test +{{#hateoas}} + + + org.springframework.boot + spring-boot-starter-hateoas + +{{/hateoas}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache index 7a3ff0b2211..64d4daf2041 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache @@ -222,6 +222,14 @@ provided {{/useBeanValidation}} +{{#hateoas}} + + + org.springframework.hateoas + spring-hateoas + 0.25.0.RELEASE + +{{/hateoas}} {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache index 39125314ca7..797b2750f0e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache @@ -19,6 +19,11 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; {{#withXml}} import javax.xml.bind.annotation.*; {{/withXml}} +{{^parent}} +{{#hateoas}} +import org.springframework.hateoas.ResourceSupport; +{{/hateoas}} +{{/parent}} {{#models}} {{#model}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index a82f2e40f4c..c5cbafc2595 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -3,7 +3,7 @@ */{{#description}} @ApiModel(description = "{{{description}}}"){{/description}} {{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} -public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}{{#hateoas}}extends ResourceSupport {{/hateoas}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#serializableModel}} private static final long serialVersionUID = 1L; From 0aec7728f9826f41576b1823213a59bdf81cd480 Mon Sep 17 00:00:00 2001 From: Thibault Duperron Date: Tue, 23 Oct 2018 17:58:03 +0200 Subject: [PATCH 23/35] [Java][jaxrs-resteasy] add @Valid when bean validation is enabled (#1237) --- .../src/main/resources/JavaJaxRS/resteasy/api.mustache | 1 + .../resources/JavaJaxRS/resteasy/bodyParams.mustache | 2 +- .../main/resources/JavaJaxRS/resteasy/eap/api.mustache | 1 + .../resources/JavaJaxRS/resteasy/eap/bodyParams.mustache | 2 +- .../src/gen/java/org/openapitools/api/PetApi.java | 5 +++-- .../src/gen/java/org/openapitools/api/StoreApi.java | 3 ++- .../src/gen/java/org/openapitools/api/UserApi.java | 9 +++++---- .../src/gen/java/org/openapitools/api/PetApi.java | 5 +++-- .../src/gen/java/org/openapitools/api/StoreApi.java | 3 ++- .../src/gen/java/org/openapitools/api/UserApi.java | 9 +++++---- .../src/gen/java/org/openapitools/api/PetApi.java | 5 +++-- .../src/gen/java/org/openapitools/api/StoreApi.java | 3 ++- .../src/gen/java/org/openapitools/api/UserApi.java | 9 +++++---- .../eap/src/gen/java/org/openapitools/api/PetApi.java | 5 +++-- .../eap/src/gen/java/org/openapitools/api/StoreApi.java | 3 ++- .../eap/src/gen/java/org/openapitools/api/UserApi.java | 9 +++++---- .../joda/src/gen/java/org/openapitools/api/PetApi.java | 5 +++-- .../joda/src/gen/java/org/openapitools/api/StoreApi.java | 3 ++- .../joda/src/gen/java/org/openapitools/api/UserApi.java | 9 +++++---- 19 files changed, 54 insertions(+), 37 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/api.mustache index ed602249c51..d15ba6aa208 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/api.mustache @@ -23,6 +23,7 @@ import javax.inject.Inject; {{#useBeanValidation}} import javax.validation.constraints.*; +import javax.validation.Valid; {{/useBeanValidation}} {{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; {{/isMultipart}}{{/operation}}{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/bodyParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/bodyParams.mustache index 2b28441d3d0..eec07e9062d 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/api.mustache index 6a8bfba99fc..5d4b072f2c3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/api.mustache @@ -19,6 +19,7 @@ import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; {{#useBeanValidation}} import javax.validation.constraints.*; +import javax.validation.Valid; {{/useBeanValidation}} {{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; {{/isMultipart}}{{/operation}}{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/bodyParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/bodyParams.mustache index 2b28441d3d0..eec07e9062d 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java index b33611ec267..a0420f55a9d 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java @@ -23,6 +23,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") @@ -46,7 +47,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return service.addPet(pet,securityContext); } @@ -135,7 +136,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return service.updatePet(pet,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/StoreApi.java index 9fd412dea03..606baea1be9 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/StoreApi.java @@ -22,6 +22,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -82,7 +83,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order,@Context SecurityContext securityContext) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @NotNull @Valid Order order,@Context SecurityContext securityContext) throws NotFoundException { return service.placeOrder(order,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java index 1970ba54db1..0d5fcb1d89f 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java @@ -22,6 +22,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -39,7 +40,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user,@Context SecurityContext securityContext) + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUser(user,securityContext); } @@ -50,7 +51,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUsersWithArrayInput(user,securityContext); } @@ -61,7 +62,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUsersWithListInput(user,securityContext); } @@ -126,7 +127,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User user,@Context SecurityContext securityContext) + public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return service.updateUser(username,user,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java index 0665516ced3..6f376ac5126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java @@ -19,6 +19,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") @@ -40,7 +41,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @DELETE @Path("/{petId}") @@ -114,7 +115,7 @@ public interface PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @POST @Path("/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/StoreApi.java index 3f37368b527..8d0d86d9345 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/StoreApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -67,5 +68,5 @@ public interface StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order,@Context SecurityContext securityContext); + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @NotNull @Valid Order order,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java index a58a79c6cf4..a88ad032f04 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -33,7 +34,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); @POST @Path("/createWithArray") @@ -41,7 +42,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @POST @Path("/createWithList") @@ -49,7 +50,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @DELETE @Path("/{username}") @@ -99,5 +100,5 @@ public interface UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java index 0665516ced3..6f376ac5126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java @@ -19,6 +19,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") @@ -40,7 +41,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @DELETE @Path("/{petId}") @@ -114,7 +115,7 @@ public interface PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @POST @Path("/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/StoreApi.java index 3f37368b527..8d0d86d9345 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/StoreApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -67,5 +68,5 @@ public interface StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order,@Context SecurityContext securityContext); + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @NotNull @Valid Order order,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java index a58a79c6cf4..a88ad032f04 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -33,7 +34,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); @POST @Path("/createWithArray") @@ -41,7 +42,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @POST @Path("/createWithList") @@ -49,7 +50,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @DELETE @Path("/{username}") @@ -99,5 +100,5 @@ public interface UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java index 0665516ced3..6f376ac5126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java @@ -19,6 +19,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") @@ -40,7 +41,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @DELETE @Path("/{petId}") @@ -114,7 +115,7 @@ public interface PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext); + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext); @POST @Path("/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/StoreApi.java index 3f37368b527..8d0d86d9345 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/StoreApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -67,5 +68,5 @@ public interface StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order,@Context SecurityContext securityContext); + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @NotNull @Valid Order order,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java index a58a79c6cf4..a88ad032f04 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java @@ -18,6 +18,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -33,7 +34,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); @POST @Path("/createWithArray") @@ -41,7 +42,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @POST @Path("/createWithList") @@ -49,7 +50,7 @@ public interface UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext); + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext); @DELETE @Path("/{username}") @@ -99,5 +100,5 @@ public interface UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User user,@Context SecurityContext securityContext); + public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java index b33611ec267..a0420f55a9d 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java @@ -23,6 +23,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") @@ -46,7 +47,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return service.addPet(pet,securityContext); } @@ -135,7 +136,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return service.updatePet(pet,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/StoreApi.java index 9fd412dea03..606baea1be9 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/StoreApi.java @@ -22,6 +22,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -82,7 +83,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order,@Context SecurityContext securityContext) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @NotNull @Valid Order order,@Context SecurityContext securityContext) throws NotFoundException { return service.placeOrder(order,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java index 1970ba54db1..0d5fcb1d89f 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java @@ -22,6 +22,7 @@ import javax.ws.rs.*; import javax.inject.Inject; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -39,7 +40,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user,@Context SecurityContext securityContext) + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUser(user,securityContext); } @@ -50,7 +51,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUsersWithArrayInput(user,securityContext); } @@ -61,7 +62,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user,@Context SecurityContext securityContext) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return service.createUsersWithListInput(user,securityContext); } @@ -126,7 +127,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User user,@Context SecurityContext securityContext) + public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return service.updateUser(username,user,securityContext); } From b36b4611de0c3260a9db1ac2464425964ebe25bd Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 23 Oct 2018 22:50:17 -0500 Subject: [PATCH 24/35] fix #1276 by adding colon (#1301) --- .../languages/StaticHtmlGenerator.java | 2 +- .../html/.openapi-generator/VERSION | 2 +- samples/documentation/html/index.html | 28 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java index 8f34f49bbac..81d02d80092 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java @@ -69,7 +69,7 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig additionalProperties.put("appName", "OpenAPI Sample"); additionalProperties.put("appDescription", "A sample OpenAPI server"); - additionalProperties.put("infoUrl", "https//openapi-generator.tech"); + additionalProperties.put("infoUrl", "https://openapi-generator.tech"); additionalProperties.put("infoEmail", "team@openapitools.org"); additionalProperties.put("licenseInfo", "All rights reserved"); additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html"); diff --git a/samples/documentation/html/.openapi-generator/VERSION b/samples/documentation/html/.openapi-generator/VERSION index 14900cee60e..a6527129083 100644 --- a/samples/documentation/html/.openapi-generator/VERSION +++ b/samples/documentation/html/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/documentation/html/index.html b/samples/documentation/html/index.html index f2a1bfb3f77..7da2214c634 100644 --- a/samples/documentation/html/index.html +++ b/samples/documentation/html/index.html @@ -181,7 +181,7 @@ font-style: italic;

OpenAPI Petstore

This is a sample server Petstore server. For this sample, you can use the api key special-key to test the authorization filters.
- +
Contact Info: team@openapitools.org
Version: 1.0.0
BasePath:/v2
@@ -277,7 +277,7 @@ font-style: italic;
petId (required)
-
Path Parameter — Pet id to delete format: int64
+
Path Parameter — Pet id to delete default: null format: int64
@@ -315,7 +315,7 @@ font-style: italic;
status (required)
-
Query Parameter — Status values that need to be considered for filter
+
Query Parameter — Status values that need to be considered for filter default: null
@@ -391,7 +391,7 @@ font-style: italic;
tags (required)
-
Query Parameter — Tags to filter by
+
Query Parameter — Tags to filter by default: null
@@ -463,7 +463,7 @@ font-style: italic;
petId (required)
-
Path Parameter — ID of pet to return format: int64
+
Path Parameter — ID of pet to return default: null format: int64
@@ -585,7 +585,7 @@ font-style: italic;
petId (required)
-
Path Parameter — ID of pet that needs to be updated format: int64
+
Path Parameter — ID of pet that needs to be updated default: null format: int64

Consumes

@@ -628,7 +628,7 @@ font-style: italic;
petId (required)
-
Path Parameter — ID of pet to update format: int64
+
Path Parameter — ID of pet to update default: null format: int64

Consumes

@@ -690,7 +690,7 @@ font-style: italic;
orderId (required)
-
Path Parameter — ID of the order that needs to be deleted
+
Path Parameter — ID of the order that needs to be deleted default: null
@@ -758,7 +758,7 @@ font-style: italic;
orderId (required)
-
Path Parameter — ID of pet that needs to be fetched format: int64
+
Path Parameter — ID of pet that needs to be fetched default: null format: int64
@@ -986,7 +986,7 @@ font-style: italic;
username (required)
-
Path Parameter — The name that needs to be deleted
+
Path Parameter — The name that needs to be deleted default: null
@@ -1019,7 +1019,7 @@ font-style: italic;
username (required)
-
Path Parameter — The name that needs to be fetched. Use user1 for testing.
+
Path Parameter — The name that needs to be fetched. Use user1 for testing. default: null
@@ -1095,9 +1095,9 @@ font-style: italic;
username (required)
-
Query Parameter — The user name for login
password (required)
+
Query Parameter — The user name for login default: null
password (required)
-
Query Parameter — The password for login in clear text
+
Query Parameter — The password for login in clear text default: null
@@ -1162,7 +1162,7 @@ font-style: italic;
username (required)
-
Path Parameter — name that need to be deleted
+
Path Parameter — name that need to be deleted default: null
From 3d7a01952411a8c9276ebcdb2c0943fd1df97c4e Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 24 Oct 2018 13:56:24 +0800 Subject: [PATCH 25/35] update samples and reenable ensure-up-to-date (#1304) --- CI/circle_parallel.sh | 2 +- docs/generators/lua.md | 2 +- samples/client/petstore/ruby/README.md | 3 + .../client/petstore/ruby/docs/DefaultApi.md | 47 +++++ samples/client/petstore/ruby/docs/Foo.md | 8 + .../ruby/docs/InlineResponseDefault.md | 8 + samples/client/petstore/ruby/lib/petstore.rb | 3 + .../ruby/lib/petstore/api/default_api.rb | 66 +++++++ .../petstore/ruby/lib/petstore/models/foo.rb | 185 ++++++++++++++++++ .../models/inline_response_default.rb | 183 +++++++++++++++++ .../ruby/spec/api/default_api_spec.rb | 44 +++++ .../petstore/ruby/spec/models/foo_spec.rb | 41 ++++ .../models/inline_response_default_spec.rb | 41 ++++ 13 files changed, 631 insertions(+), 2 deletions(-) create mode 100644 samples/client/petstore/ruby/docs/DefaultApi.md create mode 100644 samples/client/petstore/ruby/docs/Foo.md create mode 100644 samples/client/petstore/ruby/docs/InlineResponseDefault.md create mode 100644 samples/client/petstore/ruby/lib/petstore/api/default_api.rb create mode 100644 samples/client/petstore/ruby/lib/petstore/models/foo.rb create mode 100644 samples/client/petstore/ruby/lib/petstore/models/inline_response_default.rb create mode 100644 samples/client/petstore/ruby/spec/api/default_api_spec.rb create mode 100644 samples/client/petstore/ruby/spec/models/foo_spec.rb create mode 100644 samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 51d81a2afaf..cda481a62fd 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -15,7 +15,7 @@ elif [ "$NODE_INDEX" = "2" ]; then java -version #export GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w" # not formatting the code as different go versions may format the code a bit different - #./bin/utils/ensure-up-to-date + ./bin/utils/ensure-up-to-date else echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..." sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 diff --git a/docs/generators/lua.md b/docs/generators/lua.md index d35fb4f2cd3..baf2a6d5544 100644 --- a/docs/generators/lua.md +++ b/docs/generators/lua.md @@ -2,7 +2,7 @@ CONFIG OPTIONS for lua packageName - Lua package name (convention: lowercase). (Default: openapir-client) + Lua package name (convention: single word). (Default: openapiclient) packageVersion Lua package version. (Default: 1.0.0-1) diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 0bc344953b2..68720d86002 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -74,6 +74,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -129,8 +130,10 @@ Class | Method | HTTP request | Description - [Petstore::EnumTest](docs/EnumTest.md) - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Petstore::Foo](docs/Foo.md) - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) - [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/ruby/docs/DefaultApi.md b/samples/client/petstore/ruby/docs/DefaultApi.md new file mode 100644 index 00000000000..d7d2a57f285 --- /dev/null +++ b/samples/client/petstore/ruby/docs/DefaultApi.md @@ -0,0 +1,47 @@ +# Petstore::DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**foo_get**](DefaultApi.md#foo_get) | **GET** /foo | + + +# **foo_get** +> InlineResponseDefault foo_get + + + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::DefaultApi.new + +begin + result = api_instance.foo_get + p result +rescue Petstore::ApiError => e + puts "Exception when calling DefaultApi->foo_get: #{e}" +end +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/samples/client/petstore/ruby/docs/Foo.md b/samples/client/petstore/ruby/docs/Foo.md new file mode 100644 index 00000000000..3dd099f1593 --- /dev/null +++ b/samples/client/petstore/ruby/docs/Foo.md @@ -0,0 +1,8 @@ +# Petstore::Foo + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + + diff --git a/samples/client/petstore/ruby/docs/InlineResponseDefault.md b/samples/client/petstore/ruby/docs/InlineResponseDefault.md new file mode 100644 index 00000000000..96b4ac89b74 --- /dev/null +++ b/samples/client/petstore/ruby/docs/InlineResponseDefault.md @@ -0,0 +1,8 @@ +# Petstore::InlineResponseDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index d5d034f8f3f..98e4c4b7f6e 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -35,8 +35,10 @@ require 'petstore/models/enum_class' require 'petstore/models/enum_test' require 'petstore/models/file' require 'petstore/models/file_schema_test_class' +require 'petstore/models/foo' require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' +require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' require 'petstore/models/mixed_properties_and_additional_properties_class' @@ -56,6 +58,7 @@ require 'petstore/models/user' # APIs require 'petstore/api/another_fake_api' +require 'petstore/api/default_api' require 'petstore/api/fake_api' require 'petstore/api/fake_classname_tags123_api' require 'petstore/api/pet_api' diff --git a/samples/client/petstore/ruby/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb new file mode 100644 index 00000000000..32255daa98c --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb @@ -0,0 +1,66 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'uri' + +module Petstore + class DefaultApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # @param [Hash] opts the optional parameters + # @return [InlineResponseDefault] + def foo_get(opts = {}) + data, _status_code, _headers = foo_get_with_http_info(opts) + data + end + + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponseDefault, Fixnum, Hash)>] InlineResponseDefault data, response status code and response headers + def foo_get_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.foo_get ...' + end + # resource path + local_var_path = '/foo' + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'InlineResponseDefault') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#foo_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/foo.rb b/samples/client/petstore/ruby/lib/petstore/models/foo.rb new file mode 100644 index 00000000000..a8fc05cf0e6 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/foo.rb @@ -0,0 +1,185 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'date' + +module Petstore + class Foo + attr_accessor :bar + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bar' => :'bar' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'bar' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'bar') + self.bar = attributes[:'bar'] + else + self.bar = 'bar' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bar == o.bar + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [bar].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/inline_response_default.rb b/samples/client/petstore/ruby/lib/petstore/models/inline_response_default.rb new file mode 100644 index 00000000000..60d14ae0646 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/inline_response_default.rb @@ -0,0 +1,183 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineResponseDefault + attr_accessor :string + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'string' => :'string' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'string' => :'Foo' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'string') + self.string = attributes[:'string'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + string == o.string + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [string].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby/spec/api/default_api_spec.rb b/samples/client/petstore/ruby/spec/api/default_api_spec.rb new file mode 100644 index 00000000000..7783f719c56 --- /dev/null +++ b/samples/client/petstore/ruby/spec/api/default_api_spec.rb @@ -0,0 +1,44 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Petstore::DefaultApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DefaultApi' do + before do + # run before each test + @instance = Petstore::DefaultApi.new + end + + after do + # run after each test + end + + describe 'test an instance of DefaultApi' do + it 'should create an instance of DefaultApi' do + expect(@instance).to be_instance_of(Petstore::DefaultApi) + end + end + + # unit tests for foo_get + # @param [Hash] opts the optional parameters + # @return [InlineResponseDefault] + describe 'foo_get test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/client/petstore/ruby/spec/models/foo_spec.rb b/samples/client/petstore/ruby/spec/models/foo_spec.rb new file mode 100644 index 00000000000..1d9f2c551bc --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/foo_spec.rb @@ -0,0 +1,41 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::Foo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Foo' do + before do + # run before each test + @instance = Petstore::Foo.new + end + + after do + # run after each test + end + + describe 'test an instance of Foo' do + it 'should create an instance of Foo' do + expect(@instance).to be_instance_of(Petstore::Foo) + end + end + describe 'test attribute "bar"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb new file mode 100644 index 00000000000..ccbb8fcaaaf --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb @@ -0,0 +1,41 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.3.2-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineResponseDefault +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineResponseDefault' do + before do + # run before each test + @instance = Petstore::InlineResponseDefault.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineResponseDefault' do + it 'should create an instance of InlineResponseDefault' do + expect(@instance).to be_instance_of(Petstore::InlineResponseDefault) + end + end + describe 'test attribute "string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end From 76aedca6b2ff24648bddd3c3d8b7e00a8393f917 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 24 Oct 2018 13:56:39 +0800 Subject: [PATCH 26/35] Update test spec to use "localhost" instead (#1300) * update test spec to use localhost intead * add new files --- .../3_0/petstore-with-fake-endpoints-models-for-testing.yaml | 4 ++-- samples/client/petstore/ruby/lib/petstore/configuration.rb | 4 ++-- samples/client/petstore/ruby/spec/configuration_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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 8f937652fd8..10f904b50ef 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 @@ -994,8 +994,8 @@ servers: - 80 - 8080 default: 80 - - url: https://api.gigantic-server.com:8080/{version} - description: The production API server + - url: https://localhost:8080/{version} + description: The local server variables: version: enum: diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 63b8dce9e59..268674f7d61 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -254,8 +254,8 @@ module Petstore } }, { - url: "https://api.gigantic-server.com:8080/{version}", - description: "The production API server", + url: "https://localhost:8080/{version}", + description: "The local server", variables: { version: { description: "No descriptoin provided", diff --git a/samples/client/petstore/ruby/spec/configuration_spec.rb b/samples/client/petstore/ruby/spec/configuration_spec.rb index e7f9eb39727..e666b7bc004 100644 --- a/samples/client/petstore/ruby/spec/configuration_spec.rb +++ b/samples/client/petstore/ruby/spec/configuration_spec.rb @@ -40,12 +40,12 @@ describe Petstore::Configuration do it 'should get the second url with default values' do url = config.server_url(1) - expect(url).to eq("https://api.gigantic-server.com:8080/v2") + expect(url).to eq("https://localhost:8080/v2") end it 'should get the second url' do url = config.server_url(1, version: "v1") - expect(url).to eq("https://api.gigantic-server.com:8080/v1") + expect(url).to eq("https://localhost:8080/v1") end it 'should raise error due to invalid enum value' do From 24ea88495befb564a084d48458e5c38e690dc54d Mon Sep 17 00:00:00 2001 From: feihongmeilian <281006617@qq.com> Date: Wed, 24 Oct 2018 16:29:53 +0800 Subject: [PATCH 27/35] For erlang-server. add two options: packageName and openAPISpecName (#1303) * Implement the ability to read packageName and openAPISpecName from a json file * Replace '{{openAPISpecName}}' with '{{{openAPISpecName}}}' * Update erlang-petstore-server --- bin/windows/erlang-petstore-server.bat | 2 +- .../codegen/CodegenConstants.java | 1 + .../languages/ErlangServerCodegen.java | 35 ++++++++++++++----- .../resources/erlang-server/router.mustache | 2 +- .../erlang-server/.openapi-generator/VERSION | 2 +- .../petstore/erlang-server/priv/openapi.json | 2 ++ 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/bin/windows/erlang-petstore-server.bat b/bin/windows/erlang-petstore-server.bat index dc28c8c0fae..dbae5bf9faf 100755 --- a/bin/windows/erlang-petstore-server.bat +++ b/bin/windows/erlang-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\erlang-server -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g erlang-server -o samples\client\petstore\erlang-server +set ags=generate -t modules\openapi-generator\src\main\resources\erlang-server -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g erlang-server -o samples\server\petstore\erlang-server java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 7bcfb843538..1b7500c831e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -278,4 +278,5 @@ public class CodegenConstants { public static final String ENABLE_POST_PROCESS_FILE = "enablePostProcessFile"; public static final String ENABLE_POST_PROCESS_FILE_DESC = "Enable post-processing file using environment variables."; + public static final String OPEN_API_SPEC_NAME = "openAPISpecName"; } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java index 3abb6e13436..1fc21142708 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java @@ -40,6 +40,7 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig protected String apiVersion = "1.0.0"; protected String apiPath = "src"; protected String packageName = "openapi"; + protected String openApiSpecName = "openapi"; public ErlangServerCodegen() { super(); @@ -47,13 +48,6 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig // set the output folder here outputFolder = "generated-code/erlang-server"; - if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { - setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); - } else { - additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); - } - ; - /** * Models. You can write model files using the modelTemplateFiles map. * if you want to create one template for file, you can do so here. @@ -117,6 +111,27 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig cliOptions.clear(); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Erlang package name (convention: lowercase).") .defaultValue(this.packageName)); + + cliOptions.add(new CliOption(CodegenConstants.OPEN_API_SPEC_NAME, "Openapi Spec Name.") + .defaultValue(this.openApiSpecName)); + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } else { + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + } + + if (additionalProperties.containsKey(CodegenConstants.OPEN_API_SPEC_NAME)) { + setOpenApiSpecName((String) additionalProperties.get(CodegenConstants.OPEN_API_SPEC_NAME)); + } else { + additionalProperties.put(CodegenConstants.OPEN_API_SPEC_NAME, openApiSpecName); + } + /** * Additional Properties. These values can be passed to the templates and * are available in models, apis, and supporting files @@ -135,7 +150,7 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("server.mustache", "", toSourceFilePath("server", "erl"))); supportingFiles.add(new SupportingFile("utils.mustache", "", toSourceFilePath("utils", "erl"))); supportingFiles.add(new SupportingFile("auth.mustache", "", toSourceFilePath("auth", "erl"))); - supportingFiles.add(new SupportingFile("openapi.mustache", "", toPrivFilePath("openapi", "json"))); + supportingFiles.add(new SupportingFile("openapi.mustache", "", toPrivFilePath(this.openApiSpecName, "json"))); supportingFiles.add(new SupportingFile("default_logic_handler.mustache", "", toSourceFilePath("default_logic_handler", "erl"))); supportingFiles.add(new SupportingFile("logic_handler.mustache", "", toSourceFilePath("logic_handler", "erl"))); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); @@ -254,6 +269,10 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig this.packageName = packageName; } + public void setOpenApiSpecName(String openApiSpecName) { + this.openApiSpecName = openApiSpecName; + } + protected String toHandlerName(String name) { return toModuleName(name) + "_handler"; } diff --git a/modules/openapi-generator/src/main/resources/erlang-server/router.mustache b/modules/openapi-generator/src/main/resources/erlang-server/router.mustache index 740d85ccd0d..f2c3b66f9c4 100644 --- a/modules/openapi-generator/src/main/resources/erlang-server/router.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-server/router.mustache @@ -69,6 +69,6 @@ prepare_validator() -> get_openapi_path() -> {ok, AppName} = application:get_application(?MODULE), - filename:join({{packageName}}_utils:priv_dir(AppName), "openapi.json"). + filename:join({{packageName}}_utils:priv_dir(AppName), "{{{openAPISpecName}}}.json"). diff --git a/samples/server/petstore/erlang-server/.openapi-generator/VERSION b/samples/server/petstore/erlang-server/.openapi-generator/VERSION index 096bf47efe3..a6527129083 100644 --- a/samples/server/petstore/erlang-server/.openapi-generator/VERSION +++ b/samples/server/petstore/erlang-server/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/erlang-server/priv/openapi.json b/samples/server/petstore/erlang-server/priv/openapi.json index 34eb757240d..82d674b5575 100644 --- a/samples/server/petstore/erlang-server/priv/openapi.json +++ b/samples/server/petstore/erlang-server/priv/openapi.json @@ -104,6 +104,7 @@ "in" : "query", "description" : "Status values that need to be considered for filter", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", @@ -157,6 +158,7 @@ "in" : "query", "description" : "Tags to filter by", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", From 196f1228e56e9ba8688a060b8e81cdf307a6bc47 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 24 Oct 2018 21:02:23 +0800 Subject: [PATCH 28/35] update python samples and comment out flake test (#1308) --- .../petstore/python-asyncio/.openapi-generator/VERSION | 2 +- samples/client/petstore/python-asyncio/docs/Category.md | 2 +- .../python-asyncio/petstore_api/models/category.py | 7 ++++--- samples/client/petstore/python-asyncio/test_python3.sh | 2 +- .../petstore/python-tornado/.openapi-generator/VERSION | 2 +- samples/client/petstore/python-tornado/docs/Category.md | 2 +- .../python-tornado/petstore_api/models/category.py | 7 ++++--- .../client/petstore/python-tornado/test_python2_and_3.sh | 2 +- samples/client/petstore/python/.openapi-generator/VERSION | 2 +- samples/client/petstore/python/docs/Category.md | 2 +- .../client/petstore/python/petstore_api/models/category.py | 7 ++++--- samples/client/petstore/python/test_python2_and_3.sh | 2 +- 12 files changed, 21 insertions(+), 18 deletions(-) diff --git a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION index f4cb97d56ce..a6527129083 100644 --- a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION +++ b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.1-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/docs/Category.md b/samples/client/petstore/python-asyncio/docs/Category.md index 7f453539bf8..7e5c1e31649 100644 --- a/samples/client/petstore/python-asyncio/docs/Category.md +++ b/samples/client/petstore/python-asyncio/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**name** | **str** | | [optional] +**name** | **str** | | [default to 'default-name'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/category.py b/samples/client/petstore/python-asyncio/petstore_api/models/category.py index 9fbd44a7b34..5b2f79eaec8 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/category.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/category.py @@ -40,7 +40,7 @@ class Category(object): 'name': 'name' } - def __init__(self, id=None, name=None): # noqa: E501 + def __init__(self, id=None, name='default-name'): # noqa: E501 """Category - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -49,8 +49,7 @@ class Category(object): if id is not None: self.id = id - if name is not None: - self.name = name + self.name = name @property def id(self): @@ -91,6 +90,8 @@ class Category(object): :param name: The name of this Category. # noqa: E501 :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/samples/client/petstore/python-asyncio/test_python3.sh b/samples/client/petstore/python-asyncio/test_python3.sh index 01abf0b35b1..2e52066e9a5 100755 --- a/samples/client/petstore/python-asyncio/test_python3.sh +++ b/samples/client/petstore/python-asyncio/test_python3.sh @@ -24,7 +24,7 @@ python setup.py develop tox || exit 1 ### static analysis of code -flake8 --show-source petstore_api/ +#flake8 --show-source petstore_api/ ### deactivate virtualenv #if [ $DEACTIVE == true ]; then diff --git a/samples/client/petstore/python-tornado/.openapi-generator/VERSION b/samples/client/petstore/python-tornado/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/python-tornado/.openapi-generator/VERSION +++ b/samples/client/petstore/python-tornado/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/docs/Category.md b/samples/client/petstore/python-tornado/docs/Category.md index 7f453539bf8..7e5c1e31649 100644 --- a/samples/client/petstore/python-tornado/docs/Category.md +++ b/samples/client/petstore/python-tornado/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**name** | **str** | | [optional] +**name** | **str** | | [default to 'default-name'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python-tornado/petstore_api/models/category.py b/samples/client/petstore/python-tornado/petstore_api/models/category.py index 9fbd44a7b34..5b2f79eaec8 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/category.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/category.py @@ -40,7 +40,7 @@ class Category(object): 'name': 'name' } - def __init__(self, id=None, name=None): # noqa: E501 + def __init__(self, id=None, name='default-name'): # noqa: E501 """Category - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -49,8 +49,7 @@ class Category(object): if id is not None: self.id = id - if name is not None: - self.name = name + self.name = name @property def id(self): @@ -91,6 +90,8 @@ class Category(object): :param name: The name of this Category. # noqa: E501 :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/samples/client/petstore/python-tornado/test_python2_and_3.sh b/samples/client/petstore/python-tornado/test_python2_and_3.sh index 7b5795ec24a..daf08d5bacb 100755 --- a/samples/client/petstore/python-tornado/test_python2_and_3.sh +++ b/samples/client/petstore/python-tornado/test_python2_and_3.sh @@ -24,7 +24,7 @@ python setup.py develop tox || exit 1 ### static analysis of code -flake8 --show-source petstore_api/ +#flake8 --show-source petstore_api/ ### deactivate virtualenv #if [ $DEACTIVE == true ]; then diff --git a/samples/client/petstore/python/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/docs/Category.md b/samples/client/petstore/python/docs/Category.md index 7f453539bf8..7e5c1e31649 100644 --- a/samples/client/petstore/python/docs/Category.md +++ b/samples/client/petstore/python/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**name** | **str** | | [optional] +**name** | **str** | | [default to 'default-name'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/petstore_api/models/category.py b/samples/client/petstore/python/petstore_api/models/category.py index 9fbd44a7b34..5b2f79eaec8 100644 --- a/samples/client/petstore/python/petstore_api/models/category.py +++ b/samples/client/petstore/python/petstore_api/models/category.py @@ -40,7 +40,7 @@ class Category(object): 'name': 'name' } - def __init__(self, id=None, name=None): # noqa: E501 + def __init__(self, id=None, name='default-name'): # noqa: E501 """Category - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -49,8 +49,7 @@ class Category(object): if id is not None: self.id = id - if name is not None: - self.name = name + self.name = name @property def id(self): @@ -91,6 +90,8 @@ class Category(object): :param name: The name of this Category. # noqa: E501 :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/samples/client/petstore/python/test_python2_and_3.sh b/samples/client/petstore/python/test_python2_and_3.sh index 7b5795ec24a..daf08d5bacb 100755 --- a/samples/client/petstore/python/test_python2_and_3.sh +++ b/samples/client/petstore/python/test_python2_and_3.sh @@ -24,7 +24,7 @@ python setup.py develop tox || exit 1 ### static analysis of code -flake8 --show-source petstore_api/ +#flake8 --show-source petstore_api/ ### deactivate virtualenv #if [ $DEACTIVE == true ]; then From d4a5cd05cc916592b7bf55c00d050c26d783f010 Mon Sep 17 00:00:00 2001 From: Yuen-Kuei Hsueh Date: Thu, 25 Oct 2018 11:50:12 +0800 Subject: [PATCH 29/35] [Java][Spring] Add bean vaildation for email datatype (#1115) --- .../openapitools/codegen/CodegenParameter.java | 7 ++++++- .../org/openapitools/codegen/CodegenProperty.java | 7 ++++++- .../org/openapitools/codegen/CodegenResponse.java | 2 +- .../org/openapitools/codegen/DefaultCodegen.java | 13 +++++++++---- .../codegen/languages/SpringCodegen.java | 15 ++++++++++++++- .../src/main/resources/Java/model.mustache | 3 +++ .../src/main/resources/Java/pom.mustache | 8 ++++++++ .../JavaSpring/beanValidationCore.mustache | 2 ++ .../src/main/resources/JavaSpring/model.mustache | 3 +++ 9 files changed, 52 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index 661f5e2dcf5..62aa1f22b8b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -31,7 +31,7 @@ public class CodegenParameter { public String example; // example value (x-example) public String jsonSchema; - public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid; + public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isEmail; public boolean isListContainer, isMapContainer; public boolean isFile; public boolean isEnum; @@ -166,6 +166,7 @@ public class CodegenParameter { output.isDate = this.isDate; output.isDateTime = this.isDateTime; output.isUuid = this.isUuid; + output.isEmail = this.isEmail; output.isListContainer = this.isListContainer; output.isMapContainer = this.isMapContainer; @@ -256,6 +257,8 @@ public class CodegenParameter { return false; if (isUuid != that.isUuid) return false; + if (isEmail != that.isEmail) + return false; if (isListContainer != that.isListContainer) return false; if (isMapContainer != that.isMapContainer) @@ -342,6 +345,7 @@ public class CodegenParameter { result = 31 * result + (isDate ? 13:31); result = 31 * result + (isDateTime ? 13:31); result = 31 * result + (isUuid ? 13:31); + result = 31 * result + (isEmail ? 13:31); result = 31 * result + (isListContainer ? 13:31); result = 31 * result + (isMapContainer ? 13:31); result = 31 * result + (isFile ? 13:31); @@ -409,6 +413,7 @@ public class CodegenParameter { ", isDate=" + isDate + ", isDateTime=" + isDateTime + ", isUuid=" + isUuid + + ", isEmail=" + isEmail + ", isListContainer=" + isListContainer + ", isMapContainer=" + isMapContainer + ", isFile=" + isFile + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index fd3e27988ec..3fa796d45f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -56,7 +56,7 @@ public class CodegenProperty implements Cloneable { public boolean hasMore, required, secondaryParam; public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly public boolean isPrimitiveType, isModel, isContainer, isNotContainer; - public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid; + public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid, isEmail; public boolean isListContainer, isMapContainer; public boolean isEnum; public boolean isReadOnly; @@ -473,6 +473,7 @@ public class CodegenProperty implements Cloneable { result = prime * result + ((isDate ? 13:31)); result = prime * result + ((isDateTime ? 13:31)); result = prime * result + ((isUuid ? 13:31)); + result = prime * result + ((isEmail ? 13:31)); result = prime * result + ((isMapContainer ? 13:31)); result = prime * result + ((isListContainer ? 13:31)); result = prime * result + Objects.hashCode(isInherited); @@ -653,6 +654,9 @@ public class CodegenProperty implements Cloneable { if (this.isUuid != other.isUuid) { return false; } + if (this.isEmail != other.isEmail) { + return false; + } if (this.isBinary != other.isBinary) { return false; } @@ -780,6 +784,7 @@ public class CodegenProperty implements Cloneable { ", isDate=" + isDate + ", isDateTime=" + isDateTime + ", isUuid=" + isUuid + + ", isEmail=" + isEmail + ", isListContainer=" + isListContainer + ", isMapContainer=" + isMapContainer + ", isEnum=" + isEnum + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index aebc0aa9dbc..642e44a810f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -30,7 +30,7 @@ public class CodegenResponse { public List> examples; public String dataType, baseType, containerType; public boolean hasHeaders; - public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, isDateTime, isUuid; + public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, isDateTime, isUuid, isEmail; public boolean isDefault; public boolean simpleType; public boolean primitiveType; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index b7d74c78ec4..b1adc8ffa84 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1895,6 +1895,9 @@ public class DefaultCodegen implements CodegenConfig { // keep isString to true to make it backward compatible property.isString = true; property.isUuid = true; + } else if (ModelUtils.isEmailSchema(p)) { + property.isString = true; + property.isEmail = true; } else { property.isString = true; } @@ -2579,8 +2582,9 @@ public class DefaultCodegen implements CodegenConfig { } r.dataType = cp.dataType; - - if (Boolean.TRUE.equals(cp.isString) && Boolean.TRUE.equals(cp.isUuid)) { + if (Boolean.TRUE.equals(cp.isString) && Boolean.TRUE.equals(cp.isEmail)) { + r.isEmail = true; + } else if (Boolean.TRUE.equals(cp.isString) && Boolean.TRUE.equals(cp.isUuid)) { r.isUuid = true; } else if (Boolean.TRUE.equals(cp.isByteArray)) { r.isByteArray = true; @@ -3841,8 +3845,9 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.error("Codegen Property cannot be null."); return; } - - if (Boolean.TRUE.equals(property.isUuid) && Boolean.TRUE.equals(property.isString)) { + if (Boolean.TRUE.equals(property.isEmail) && Boolean.TRUE.equals(property.isString)) { + parameter.isEmail = true; + } else if (Boolean.TRUE.equals(property.isUuid) && Boolean.TRUE.equals(property.isString)) { parameter.isUuid = true; } else if (Boolean.TRUE.equals(property.isByteArray)) { parameter.isByteArray = true; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index d5c420154db..719c4a47042 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -34,6 +34,7 @@ import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.OptionalFeatures; +import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +52,8 @@ import java.util.stream.Collectors; public class SpringCodegen extends AbstractJavaCodegen - implements BeanValidationFeatures, OptionalFeatures { + implements BeanValidationFeatures, PerformBeanValidationFeatures, + OptionalFeatures { private static final Logger LOGGER = LoggerFactory.getLogger(SpringCodegen.class); public static final String TITLE = "title"; @@ -89,6 +91,7 @@ public class SpringCodegen extends AbstractJavaCodegen protected String responseWrapper = ""; protected boolean useTags = false; protected boolean useBeanValidation = true; + protected boolean performBeanValidation = false; protected boolean implicitHeaders = false; protected boolean openapiDocketConfig = false; protected boolean apiFirst = false; @@ -122,6 +125,7 @@ public class SpringCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(VIRTUAL_SERVICE, "Generates the virtual service. For more details refer - https://github.com/elan-venture/virtualan/wiki")); cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames", useTags)); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation)); + cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Use Bean Validation Impl. to perform BeanValidation", performBeanValidation)); cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Use of @ApiImplicitParams for headers.", implicitHeaders)); cliOptions.add(CliOption.newBoolean(OPENAPI_DOCKET_CONFIG, "Generate Spring OpenAPI Docket configuration class.", openapiDocketConfig)); cliOptions.add(CliOption.newBoolean(API_FIRST, "Generate the API from the OAI spec at server compile time (API first approach)", apiFirst)); @@ -248,6 +252,11 @@ public class SpringCodegen extends AbstractJavaCodegen } writePropertyBack(USE_BEANVALIDATION, useBeanValidation); + if (additionalProperties.containsKey(PERFORM_BEANVALIDATION)) { + this.setPerformBeanValidation(convertPropertyToBoolean(PERFORM_BEANVALIDATION)); + } + writePropertyBack(PERFORM_BEANVALIDATION, performBeanValidation); + if (additionalProperties.containsKey(USE_OPTIONAL)) { this.setUseOptional(convertPropertyToBoolean(USE_OPTIONAL)); } @@ -761,6 +770,10 @@ public class SpringCodegen extends AbstractJavaCodegen this.useBeanValidation = useBeanValidation; } + public void setPerformBeanValidation(boolean performBeanValidation) { + this.performBeanValidation = performBeanValidation; + } + @Override public void setUseOptional(boolean useOptional) { this.useOptional = useOptional; diff --git a/modules/openapi-generator/src/main/resources/Java/model.mustache b/modules/openapi-generator/src/main/resources/Java/model.mustache index a42a1359e4d..2154453a885 100644 --- a/modules/openapi-generator/src/main/resources/Java/model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/model.mustache @@ -31,6 +31,9 @@ import android.os.Parcel; import javax.validation.constraints.*; import javax.validation.Valid; {{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} {{#models}} {{#model}} diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index a2703f141d0..ed6e39c78ea 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -313,6 +313,14 @@ provided {{/useBeanValidation}} + {{#performBeanValidation}} + + + org.hibernate + hibernate-validator + 5.4.1.Final + + {{/performBeanValidation}} {{#parcelableModel}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache index 4b7b561ce70..3f98adfc6f3 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache @@ -11,6 +11,8 @@ minLength not set, maxLength set }}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems not set && maxItems set }}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +@Email: performBeanValidation set && isEmail set +}}{{#performBeanValidation}}{{#isEmail}}@Email{{/isEmail}}{{/performBeanValidation}}{{! check for integer or long / all others=decimal type with @Decimal* isInteger set }}{{#isInteger}}{{#minimum}}@Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}) {{/maximum}}{{/isInteger}}{{! diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache index 797b2750f0e..17abea16f2e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/model.mustache @@ -10,6 +10,9 @@ import java.io.Serializable; import javax.validation.Valid; import javax.validation.constraints.*; {{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} {{#jackson}} {{#withXml}} import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; From eb4dfe0fc1362f82d91d8371e7493dc4e1195d24 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 25 Oct 2018 12:29:54 +0800 Subject: [PATCH 30/35] update documentation --- docs/generators/erlang-server.md | 3 +++ docs/generators/spring.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/generators/erlang-server.md b/docs/generators/erlang-server.md index 29c7d51313d..51fc0c2d971 100644 --- a/docs/generators/erlang-server.md +++ b/docs/generators/erlang-server.md @@ -4,4 +4,7 @@ CONFIG OPTIONS for erlang-server packageName Erlang package name (convention: lowercase). (Default: openapi) + openAPISpecName + Openapi Spec Name. (Default: openapi) + Back to the [generators list](README.md) diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 7a3d7bf0bb7..e7d64807746 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -152,6 +152,9 @@ CONFIG OPTIONS for spring useBeanValidation Use BeanValidation API annotations (Default: true) + performBeanValidation + Use Bean Validation Impl. to perform BeanValidation (Default: false) + implicitHeaders Use of @ApiImplicitParams for headers. (Default: false) From f4eb96933adff53997edbea9a444b2d213c62a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Courtine?= Date: Fri, 26 Oct 2018 11:24:14 +0200 Subject: [PATCH 31/35] [Rust] Client library choice between hyper and reqwest (#1258) * Port of PR https://github.com/swagger-api/swagger-codegen/pull/8804. * Correction of conflict with PR #528 (missing template file). * Add rust-reqwest samples to Circle CI tests. * Add integration test pom.xml file with launcher to trigger cargo execution. * Deduplicate Maven project name. * Fix "api_key" header for Petstore. * Better API key management. * Fix query param for lists of objects other than strings (numbers, etc.). * Update to reqwest 0.9, and refactor of header management (using reqwest transition feature). * Merge scripts generating rust-hyper and rust-reqwest samples. * Consistent full stops. * Use raw variables in all Rust mustache templates. * Replace production build in CI with a quick simple check. * Update samples. * Finish Reqwest 0.9 migration (removing "hyper 0.11" transition feature). * Configuration implements Default trait. * API template reorganized: HashMap is not required anymore. * Revert "Merge scripts generating rust-hyper and rust-reqwest samples." This reverts commit 970f996566a740045f2a986fd70fc70f11952925. * Remove deprecated "-XX:MaxPermSize" java arg. --- bin/rust-petstore.sh | 4 +- bin/rust-reqwest-petstore.sh | 32 ++ .../codegen/languages/RustClientCodegen.java | 86 +++-- .../src/main/resources/rust/Cargo.mustache | 21 +- .../src/main/resources/rust/README.mustache | 20 +- .../src/main/resources/rust/api_doc.mustache | 16 +- .../resources/rust/{ => hyper}/api.mustache | 22 +- .../rust/{ => hyper}/api_mod.mustache | 4 +- .../rust/{ => hyper}/client.mustache | 8 +- .../rust/{ => hyper}/configuration.mustache | 2 +- .../src/main/resources/rust/lib.mustache | 16 + .../src/main/resources/rust/model.mustache | 32 +- .../main/resources/rust/model_doc.mustache | 4 +- .../main/resources/rust/reqwest/api.mustache | 113 +++++++ .../resources/rust/reqwest/api_mod.mustache | 38 +++ .../resources/rust/reqwest/client.mustache | 55 ++++ .../rust/reqwest/configuration.mustache | 39 +++ pom.xml | 1 + .../client/petstore/rust-reqwest/.gitignore | 3 + .../rust-reqwest/.openapi-generator-ignore | 23 ++ .../rust-reqwest/.openapi-generator/VERSION | 1 + .../client/petstore/rust-reqwest/.travis.yml | 1 + .../client/petstore/rust-reqwest/Cargo.toml | 13 + .../client/petstore/rust-reqwest/README.md | 97 ++++++ .../petstore/rust-reqwest/docs/ApiResponse.md | 12 + .../petstore/rust-reqwest/docs/Category.md | 11 + .../petstore/rust-reqwest/docs/Order.md | 15 + .../client/petstore/rust-reqwest/docs/Pet.md | 15 + .../petstore/rust-reqwest/docs/PetApi.md | 259 +++++++++++++++ .../petstore/rust-reqwest/docs/StoreApi.md | 115 +++++++ .../client/petstore/rust-reqwest/docs/Tag.md | 11 + .../client/petstore/rust-reqwest/docs/User.md | 17 + .../petstore/rust-reqwest/docs/UserApi.md | 221 +++++++++++++ .../client/petstore/rust-reqwest/git_push.sh | 52 +++ samples/client/petstore/rust-reqwest/pom.xml | 46 +++ .../petstore/rust-reqwest/src/apis/client.rs | 37 +++ .../rust-reqwest/src/apis/configuration.rs | 48 +++ .../petstore/rust-reqwest/src/apis/mod.rs | 32 ++ .../petstore/rust-reqwest/src/apis/pet_api.rs | 298 ++++++++++++++++++ .../rust-reqwest/src/apis/store_api.rs | 155 +++++++++ .../rust-reqwest/src/apis/user_api.rs | 263 ++++++++++++++++ .../client/petstore/rust-reqwest/src}/lib.rs | 3 +- .../rust-reqwest/src/models/api_response.rs | 90 ++++++ .../rust-reqwest/src/models/category.rs | 70 ++++ .../petstore/rust-reqwest/src/models/mod.rs | 15 + .../petstore/rust-reqwest/src/models/order.rs | 151 +++++++++ .../petstore/rust-reqwest/src/models/pet.rs | 145 +++++++++ .../petstore/rust-reqwest/src/models/tag.rs | 70 ++++ .../petstore/rust-reqwest/src/models/user.rs | 191 +++++++++++ .../petstore/rust/.openapi-generator/VERSION | 2 +- samples/client/petstore/rust/Cargo.toml | 14 +- samples/client/petstore/rust/docs/PetApi.md | 4 +- samples/client/petstore/rust/docs/UserApi.md | 4 +- samples/client/petstore/rust/pom.xml | 3 +- samples/client/petstore/rust/src/lib.rs | 4 +- 55 files changed, 2912 insertions(+), 112 deletions(-) create mode 100755 bin/rust-reqwest-petstore.sh rename modules/openapi-generator/src/main/resources/rust/{ => hyper}/api.mustache (53%) rename modules/openapi-generator/src/main/resources/rust/{ => hyper}/api_mod.mustache (92%) rename modules/openapi-generator/src/main/resources/rust/{ => hyper}/client.mustache (76%) rename modules/openapi-generator/src/main/resources/rust/{ => hyper}/configuration.mustache (88%) create mode 100644 modules/openapi-generator/src/main/resources/rust/lib.mustache create mode 100644 modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache create mode 100644 modules/openapi-generator/src/main/resources/rust/reqwest/client.mustache create mode 100644 modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache create mode 100644 samples/client/petstore/rust-reqwest/.gitignore create mode 100644 samples/client/petstore/rust-reqwest/.openapi-generator-ignore create mode 100644 samples/client/petstore/rust-reqwest/.openapi-generator/VERSION create mode 100644 samples/client/petstore/rust-reqwest/.travis.yml create mode 100644 samples/client/petstore/rust-reqwest/Cargo.toml create mode 100644 samples/client/petstore/rust-reqwest/README.md create mode 100644 samples/client/petstore/rust-reqwest/docs/ApiResponse.md create mode 100644 samples/client/petstore/rust-reqwest/docs/Category.md create mode 100644 samples/client/petstore/rust-reqwest/docs/Order.md create mode 100644 samples/client/petstore/rust-reqwest/docs/Pet.md create mode 100644 samples/client/petstore/rust-reqwest/docs/PetApi.md create mode 100644 samples/client/petstore/rust-reqwest/docs/StoreApi.md create mode 100644 samples/client/petstore/rust-reqwest/docs/Tag.md create mode 100644 samples/client/petstore/rust-reqwest/docs/User.md create mode 100644 samples/client/petstore/rust-reqwest/docs/UserApi.md create mode 100644 samples/client/petstore/rust-reqwest/git_push.sh create mode 100644 samples/client/petstore/rust-reqwest/pom.xml create mode 100644 samples/client/petstore/rust-reqwest/src/apis/client.rs create mode 100644 samples/client/petstore/rust-reqwest/src/apis/configuration.rs create mode 100644 samples/client/petstore/rust-reqwest/src/apis/mod.rs create mode 100644 samples/client/petstore/rust-reqwest/src/apis/pet_api.rs create mode 100644 samples/client/petstore/rust-reqwest/src/apis/store_api.rs create mode 100644 samples/client/petstore/rust-reqwest/src/apis/user_api.rs rename {modules/openapi-generator/src/main/resources/rust => samples/client/petstore/rust-reqwest/src}/lib.rs (76%) create mode 100644 samples/client/petstore/rust-reqwest/src/models/api_response.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/category.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/mod.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/order.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/pet.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/tag.rs create mode 100644 samples/client/petstore/rust-reqwest/src/models/user.rs diff --git a/bin/rust-petstore.sh b/bin/rust-petstore.sh index ffab5a47afb..b58d3de7dd6 100755 --- a/bin/rust-petstore.sh +++ b/bin/rust-petstore.sh @@ -26,7 +26,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client --library=hyper $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/rust-reqwest-petstore.sh b/bin/rust-reqwest-petstore.sh new file mode 100755 index 00000000000..054a757c5fa --- /dev/null +++ b/bin/rust-reqwest-petstore.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest -DpackageName=petstore_client --library=reqwest $@" + +java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index da9763a281f..c7cc86038cf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -17,27 +17,17 @@ package org.openapitools.codegen.languages; +import com.google.common.base.Strings; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConfig; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenOperation; -import org.openapitools.codegen.CodegenProperty; -import org.openapitools.codegen.CodegenType; -import org.openapitools.codegen.DefaultCodegen; -import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; +import java.util.*; public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @@ -45,6 +35,9 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String PACKAGE_NAME = "packageName"; public static final String PACKAGE_VERSION = "packageVersion"; + public static final String HYPER_LIBRARY = "hyper"; + public static final String REQWEST_LIBRARY = "reqwest"; + protected String packageName = "openapi"; protected String packageVersion = "1.0.0"; protected String apiDocPath = "docs/"; @@ -68,7 +61,6 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { super(); outputFolder = "generated-code/rust"; modelTemplateFiles.put("model.mustache", ".rs"); - apiTemplateFiles.put("api.mustache", ".rs"); modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); @@ -141,6 +133,15 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC) .defaultValue(Boolean.TRUE.toString())); + supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper."); + supportedLibraries.put(REQWEST_LIBRARY, "HTTP client: Reqwest."); + + CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use."); + libraryOption.setEnum(supportedLibraries); + // set hyper as the default + libraryOption.setDefault(HYPER_LIBRARY); + cliOptions.add(libraryOption); + setLibrary(HYPER_LIBRARY); } @Override @@ -165,21 +166,34 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); + if ( HYPER_LIBRARY.equals(getLibrary())){ + additionalProperties.put(HYPER_LIBRARY, "true"); + } else if (REQWEST_LIBRARY.equals(getLibrary())) { + additionalProperties.put(REQWEST_LIBRARY, "true"); + } else { + LOGGER.error("Unknown library option (-l/--library): {}", getLibrary()); + } + + apiTemplateFiles.put(getLibrary() + "/api.mustache", ".rs"); + modelPackage = packageName; apiPackage = packageName; supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - supportingFiles.add(new SupportingFile("configuration.mustache", apiFolder, "configuration.rs")); supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); - - supportingFiles.add(new SupportingFile("api_mod.mustache", apiFolder, "mod.rs")); - supportingFiles.add(new SupportingFile("client.mustache", apiFolder, "client.rs")); - supportingFiles.add(new SupportingFile("request.rs", apiFolder, "request.rs")); supportingFiles.add(new SupportingFile("model_mod.mustache", modelFolder, "mod.rs")); - supportingFiles.add(new SupportingFile("lib.rs", "src", "lib.rs")); + supportingFiles.add(new SupportingFile("lib.mustache", "src", "lib.rs")); supportingFiles.add(new SupportingFile("Cargo.mustache", "", "Cargo.toml")); + + if (HYPER_LIBRARY.equals(getLibrary())) { + supportingFiles.add(new SupportingFile("request.rs", apiFolder, "request.rs")); + } + + supportingFiles.add(new SupportingFile(getLibrary() + "/configuration.mustache", apiFolder, "configuration.rs")); + supportingFiles.add(new SupportingFile(getLibrary() + "/client.mustache", apiFolder, "client.rs")); + supportingFiles.add(new SupportingFile(getLibrary() + "/api_mod.mustache", apiFolder, "mod.rs")); } @Override @@ -209,7 +223,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { return name; // snake_case, e.g. PetId => pet_id - name = org.openapitools.codegen.utils.StringUtils.underscore(name); + name = StringUtils.underscore(name); // for reserved word or word starting with number, append _ if (isReservedWord(name)) @@ -231,16 +245,17 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { public String toModelName(String name) { // camelize the model name // phone_number => PhoneNumber - return org.openapitools.codegen.utils.StringUtils.camelize(toModelFilename(name)); + return StringUtils.camelize(toModelFilename(name)); } @Override public String toModelFilename(String name) { - if (!StringUtils.isEmpty(modelNamePrefix)) { + + if (!Strings.isNullOrEmpty(modelNamePrefix)) { name = modelNamePrefix + "_" + name; } - if (!StringUtils.isEmpty(modelNameSuffix)) { + if (!Strings.isNullOrEmpty(modelNameSuffix)) { name = name + "_" + modelNameSuffix; } @@ -258,7 +273,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return org.openapitools.codegen.utils.StringUtils.underscore(name); + return StringUtils.underscore(name); } @Override @@ -267,7 +282,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.rs => pet_api.rs - return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; + return StringUtils.underscore(name) + "_api"; } @Override @@ -340,11 +355,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + StringUtils.underscore("call_" + operationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } - return org.openapitools.codegen.utils.StringUtils.underscore(sanitizedOperationId); + return StringUtils.underscore(sanitizedOperationId); } @Override @@ -353,9 +368,15 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { Map objectMap = (Map) objs.get("operations"); @SuppressWarnings("unchecked") List operations = (List) objectMap.get("operation"); + Set headerKeys = new HashSet<>(); for (CodegenOperation operation : operations) { - // http method verb conversion (e.g. PUT => Put) - operation.httpMethod = org.openapitools.codegen.utils.StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); + // http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put) + if (HYPER_LIBRARY.equals(getLibrary())) { + operation.httpMethod = StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); + } else if (REQWEST_LIBRARY.equals(getLibrary())) { + operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT); + } + // update return type to conform to rust standard /* if (operation.returnType != null) { @@ -407,6 +428,9 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { }*/ } + additionalProperties.put("headerKeys", headerKeys); + additionalProperties.putIfAbsent("authHeaderKey", "api-key"); + return objs; } diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache index 6b524874aad..6fc033fe6c8 100644 --- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache @@ -4,14 +4,21 @@ version = "{{{packageVersion}}}" authors = ["OpenAPI Generator team and contributors"] [dependencies] -serde = "1.0" -serde_derive = "1.0" -serde_yaml = "0.7" -serde_json = "1.0" -base64 = "~0.7.0" -futures = "0.1.16" -hyper = "0.11.6" +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" url = "1.5" +{{#hyper}} +hyper = "~0.11" +serde_yaml = "0.7" +base64 = "~0.7.0" +futures = "0.1.23" +{{/hyper}} +{{#reqwest}} +reqwest = "~0.9" +{{/reqwest}} [dev-dependencies] +{{#hyper}} tokio-core = "*" +{{/hyper}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/rust/README.mustache b/modules/openapi-generator/src/main/resources/rust/README.mustache index 823a371d999..712357f80fa 100644 --- a/modules/openapi-generator/src/main/resources/rust/README.mustache +++ b/modules/openapi-generator/src/main/resources/rust/README.mustache @@ -1,4 +1,4 @@ -# Rust API client for {{packageName}} +# Rust API client for {{{packageName}}} {{#appDescription}} {{{appDescription}}} @@ -7,12 +7,12 @@ ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. -- API version: {{appVersion}} -- Package version: {{packageVersion}} +- API version: {{{appVersion}}} +- Package version: {{{packageVersion}}} {{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} +- Build date: {{{generatedDate}}} {{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} +- Build package: {{{generatorClass}}} {{#infoUrl}} For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} @@ -20,21 +20,21 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Installation Put the package under your project folder and add the following in import: ``` - "./{{packageName}}" + "./{{{packageName}}}" ``` ## Documentation for API Endpoints -All URIs are relative to *{{basePath}}* +All URIs are relative to *{{{basePath}}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{{classname}}}* | [**{{{operationId}}}**]({{{apiDocPath}}}{{classname}}.md#{{{operationIdLowerCase}}}) | **{{{httpMethod}}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation For Models -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{#models}}{{#model}} - [{{{classname}}}]({{{modelDocPath}}}{{{classname}}}.md) {{/model}}{{/models}} ## Documentation For Authorization @@ -92,5 +92,5 @@ Or via OAuth2 module to automatically refresh tokens and perform user authentica ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{#apiInfo}}{{#apis}}{{^hasMore}}{{{infoEmail}}} {{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache index 29eb3c2e5ec..c6fb6db4664 100644 --- a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache @@ -1,17 +1,17 @@ -# {{invokerPackage}}\{{classname}}{{#description}} -{{description}}{{/description}} +# {{{invokerPackage}}}\{{{classname}}}{{#description}} +{{{description}}}{{/description}} -All URIs are relative to *{{basePath}}* +All URIs are relative to *{{{basePath}}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#operations}}{{#operation}}[**{{{operationId}}}**]({{{classname}}}.md#{{{operationId}}}) | **{{{httpMethod}}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}} {{/operation}}{{/operations}} {{#operations}} {{#operation}} # **{{{operationId}}}** -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#authMethods}}ctx, {{/authMethods}}{{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#authMethods}}ctx, {{/authMethods}}{{#allParams}}{{#required}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) {{{summary}}}{{#notes}} {{{notes}}}{{/notes}} @@ -21,7 +21,7 @@ Method | HTTP request | Description Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{#authMethods}} **ctx** | **context.Context** | context containing the authentication | nil if no authentication{{/authMethods}}{{/-last}}{{/allParams}}{{#allParams}}{{#required}} - **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} + **{{{paramName}}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{baseType}}}.md){{/isPrimitiveType}}| {{{description}}} | {{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters @@ -29,11 +29,11 @@ Optional parameters are passed through a map[string]interface{}. {{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} - **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}} + **{{{paramName}}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{baseType}}}.md){{/isPrimitiveType}}| {{{description}}} | {{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}} ### Return type -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{{returnBaseType}}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} ### Authorization diff --git a/modules/openapi-generator/src/main/resources/rust/api.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache similarity index 53% rename from modules/openapi-generator/src/main/resources/rust/api.mustache rename to modules/openapi-generator/src/main/resources/rust/hyper/api.mustache index 3e59a5839db..426fee7fe80 100644 --- a/modules/openapi-generator/src/main/resources/rust/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache @@ -21,20 +21,20 @@ impl {{{classname}}}Client { } } -pub trait {{classname}} { +pub trait {{{classname}}} { {{#operations}} {{#operation}} - fn {{{operationId}}}(&self, {{#allParams}}{{paramName}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box>>; + fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box>>; {{/operation}} {{/operations}} } -impl{{classname}} for {{classname}}Client { +impl{{{classname}}} for {{{classname}}}Client { {{#operations}} {{#operation}} - fn {{{operationId}}}(&self, {{#allParams}}{{paramName}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box>> { - __internal_request::Request::new(hyper::Method::{{httpMethod}}, "{{{path}}}".to_string()) + fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box>> { + __internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string()) {{#hasAuthMethods}} {{#authMethods}} {{#isApiKey}} @@ -53,29 +53,29 @@ impl{{classname}} for {{classname}}Client { {{/authMethods}} {{/hasAuthMethods}} {{#queryParams}} - .with_query_param("{{baseName}}".to_string(), {{paramName}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) + .with_query_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) {{/queryParams}} {{#pathParams}} - .with_path_param("{{baseName}}".to_string(), {{paramName}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) + .with_path_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) {{/pathParams}} {{#hasHeaderParams}} {{#headerParams}} - .with_header_param("{{baseName}}".to_string(), {{paramName}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) + .with_header_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) {{/headerParams}} {{/hasHeaderParams}} {{#hasFormParams}} {{#formParams}} {{#isFile}} - .with_form_param("{{baseName}}".to_string(), unimplemented!()) + .with_form_param("{{{baseName}}}".to_string(), unimplemented!()) {{/isFile}} {{^isFile}} - .with_form_param("{{baseName}}".to_string(), {{paramName}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) + .with_form_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()) {{/isFile}} {{/formParams}} {{/hasFormParams}} {{#hasBodyParam}} {{#bodyParams}} - .with_body_param({{paramName}}) + .with_body_param({{{paramName}}}) {{/bodyParams}} {{/hasBodyParam}} {{^returnType}} diff --git a/modules/openapi-generator/src/main/resources/rust/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache similarity index 92% rename from modules/openapi-generator/src/main/resources/rust/api_mod.mustache rename to modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache index 1f587b0d52f..1deca998a0d 100644 --- a/modules/openapi-generator/src/main/resources/rust/api_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache @@ -55,11 +55,11 @@ mod request; {{#apiInfo}} {{#apis}} -mod {{classFilename}}; +mod {{{classFilename}}}; {{#operations}} {{#operation}} {{#-last}} -pub use self::{{classFilename}}::{ {{classname}}, {{classname}}Client }; +pub use self::{{{classFilename}}}::{ {{{classname}}}, {{{classname}}}Client }; {{/-last}} {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/rust/client.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/client.mustache similarity index 76% rename from modules/openapi-generator/src/main/resources/rust/client.mustache rename to modules/openapi-generator/src/main/resources/rust/hyper/client.mustache index faaea0dbd2f..71b31ccc993 100644 --- a/modules/openapi-generator/src/main/resources/rust/client.mustache +++ b/modules/openapi-generator/src/main/resources/rust/hyper/client.mustache @@ -10,7 +10,7 @@ pub struct APIClient { {{#operations}} {{#operation}} {{#-last}} - {{classFilename}}: Box<::apis::{{classname}}>, + {{{classFilename}}}: Box<::apis::{{{classname}}}>, {{/-last}} {{/operation}} {{/operations}} @@ -29,7 +29,7 @@ impl APIClient { {{#operations}} {{#operation}} {{#-last}} - {{classFilename}}: Box::new(::apis::{{classname}}Client::new(rc.clone())), + {{{classFilename}}}: Box::new(::apis::{{{classname}}}Client::new(rc.clone())), {{/-last}} {{/operation}} {{/operations}} @@ -43,8 +43,8 @@ impl APIClient { {{#operations}} {{#operation}} {{#-last}} - pub fn {{classFilename}}(&self) -> &::apis::{{classname}}{ - self.{{classFilename}}.as_ref() + pub fn {{{classFilename}}}(&self) -> &::apis::{{{classname}}}{ + self.{{{classFilename}}}.as_ref() } {{/-last}} diff --git a/modules/openapi-generator/src/main/resources/rust/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/configuration.mustache similarity index 88% rename from modules/openapi-generator/src/main/resources/rust/configuration.mustache rename to modules/openapi-generator/src/main/resources/rust/hyper/configuration.mustache index a30f5014e35..8c273278d6b 100644 --- a/modules/openapi-generator/src/main/resources/rust/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/rust/hyper/configuration.mustache @@ -23,7 +23,7 @@ impl Configuration { pub fn new(client: hyper::client::Client) -> Configuration { Configuration { base_path: "{{{basePath}}}".to_owned(), - user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{version}}/rust".to_owned()){{/httpUserAgent}}, + user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{{version}}}/rust".to_owned()){{/httpUserAgent}}, client: client, basic_auth: None, oauth_access_token: None, diff --git a/modules/openapi-generator/src/main/resources/rust/lib.mustache b/modules/openapi-generator/src/main/resources/rust/lib.mustache new file mode 100644 index 00000000000..cdc5287aae7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/rust/lib.mustache @@ -0,0 +1,16 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +{{#hyper}} +extern crate hyper; +extern crate futures; +{{/hyper}} +{{#reqwest}} +extern crate reqwest; +{{/reqwest}} + +pub mod apis; +pub mod models; diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index afb557c3410..6c86c531d36 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -9,45 +9,45 @@ use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] -pub struct {{classname}} { +pub struct {{{classname}}} { {{#vars}} {{#description}} /// {{{description}}} {{/description}} - #[serde(rename = "{{baseName}}")] - {{name}}: {{^required}}Option<{{/required}}{{{dataType}}}{{^required}}>{{/required}}{{#hasMore}},{{/hasMore}} + #[serde(rename = "{{{baseName}}}")] + {{{name}}}: {{^required}}Option<{{/required}}{{{dataType}}}{{^required}}>{{/required}}{{#hasMore}},{{/hasMore}} {{/vars}} } -impl {{classname}} { +impl {{{classname}}} { {{#description}} /// {{{description}}} {{/description}} - pub fn new({{#requiredVars}}{{name}}: {{{dataType}}}{{^-last}}, {{/-last}}{{/requiredVars}}) -> {{classname}} { - {{classname}} { + pub fn new({{#requiredVars}}{{{name}}}: {{{dataType}}}{{^-last}}, {{/-last}}{{/requiredVars}}) -> {{{classname}}} { + {{{classname}}} { {{#vars}} - {{name}}: {{#required}}{{name}}{{/required}}{{^required}}{{#isListContainer}}None{{/isListContainer}}{{#isMapContainer}}None{{/isMapContainer}}{{^isContainer}}None{{/isContainer}}{{/required}}{{#hasMore}},{{/hasMore}} + {{{name}}}: {{#required}}{{{name}}}{{/required}}{{^required}}{{#isListContainer}}None{{/isListContainer}}{{#isMapContainer}}None{{/isMapContainer}}{{^isContainer}}None{{/isContainer}}{{/required}}{{#hasMore}},{{/hasMore}} {{/vars}} } } {{#vars}} - pub fn set_{{name}}(&mut self, {{name}}: {{{dataType}}}) { - self.{{name}} = {{^required}}Some({{name}}){{/required}}{{#required}}{{name}}{{/required}}; + pub fn set_{{{name}}}(&mut self, {{{name}}}: {{{dataType}}}) { + self.{{{name}}} = {{^required}}Some({{{name}}}){{/required}}{{#required}}{{{name}}}{{/required}}; } - pub fn with_{{name}}(mut self, {{name}}: {{{dataType}}}) -> {{classname}} { - self.{{name}} = {{^required}}Some({{name}}){{/required}}{{#required}}{{name}}{{/required}}; + pub fn with_{{{name}}}(mut self, {{{name}}}: {{{dataType}}}) -> {{{classname}}} { + self.{{{name}}} = {{^required}}Some({{{name}}}){{/required}}{{#required}}{{{name}}}{{/required}}; self } - pub fn {{name}}(&self) -> {{^required}}Option<{{/required}}&{{{dataType}}}{{^required}}>{{/required}} { - {{#required}}&{{/required}}self.{{name}}{{^required}}.as_ref(){{/required}} + pub fn {{{name}}}(&self) -> {{^required}}Option<{{/required}}&{{{dataType}}}{{^required}}>{{/required}} { + {{#required}}&{{/required}}self.{{{name}}}{{^required}}.as_ref(){{/required}} } {{^required}} - pub fn reset_{{name}}(&mut self) { - self.{{name}} = None; + pub fn reset_{{{name}}}(&mut self) { + self.{{{name}}} = None; } {{/required}} @@ -60,7 +60,7 @@ impl {{classname}} { //const ( // {{#allowableValues}} // {{#enumVars}} -// {{name}} {{{classname}}} = "{{{value}}}" +// {{{name}}} {{{classname}}} = "{{{value}}}" // {{/enumVars}} // {{/allowableValues}} //) diff --git a/modules/openapi-generator/src/main/resources/rust/model_doc.mustache b/modules/openapi-generator/src/main/resources/rust/model_doc.mustache index ccfd3f8d0de..aeaeb959166 100644 --- a/modules/openapi-generator/src/main/resources/rust/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model_doc.mustache @@ -1,9 +1,9 @@ -{{#models}}{{#model}}# {{classname}} +{{#models}}{{#model}}# {{{classname}}} ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{#vars}}**{{{name}}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{{dataType}}}**]({{{complexType}}}.md){{/isPrimitiveType}} | {{{description}}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} {{/vars}} [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache new file mode 100644 index 00000000000..091c40fe625 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -0,0 +1,113 @@ +{{>partial_header}} +use std::rc::Rc; +use std::borrow::Borrow; + +use reqwest; + +use super::{Error, configuration}; + +pub struct {{{classname}}}Client { + configuration: Rc, +} + +impl {{{classname}}}Client { + pub fn new(configuration: Rc) -> {{{classname}}}Client { + {{{classname}}}Client { + configuration: configuration, + } + } +} + +pub trait {{{classname}}} { +{{#operations}} +{{#operation}} + fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>; +{{/operation}} +{{/operations}} +} + + +impl {{{classname}}} for {{{classname}}}Client { +{{#operations}} +{{#operation}} + fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); +{{#queryParams}} + query.append_pair("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::>().join(","){{/isListContainer}}.to_string()); +{{/queryParams}} +{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let val = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + query.append_pair("{{{keyParamName}}}".to_owned(), val); + } +{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}{{/hasAuthMethods}} + query.finish() + }; + let uri_str = format!("{}{{{path}}}?{}", configuration.base_path, query_string{{#pathParams}}, {{{baseName}}}={{{paramName}}}{{#isListContainer}}.join(",").as_ref(){{/isListContainer}}{{/pathParams}}); + + let mut req_builder = client.{{{httpMethod}}}(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + {{#hasHeaderParams}} + {{#headerParams}} + req_builder = req_builder.header("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); + {{/headerParams}} + {{/hasHeaderParams}} + + {{#hasAuthMethods}} + {{#authMethods}} + {{#isApiKey}}{{#isKeyInHeader}} + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let val = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("{{{keyParamName}}}", val); + }; + {{/isKeyInHeader}}{{/isApiKey}} + {{#isBasic}} + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + {{/isBasic}} + {{#isOAuth}} + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + {{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{#hasBodyParam}} + {{#bodyParams}} + req_builder = req_builder.json(&{{{paramName}}}); + {{/bodyParams}} + {{/hasBodyParam}} + + // send request + let req = req_builder.build()?; + + {{^returnType}} + client.execute(req)?.error_for_status()?; + Ok(()) + {{/returnType}} + {{#returnType}} + Ok(client.execute(req)?.error_for_status()?.json()?) + {{/returnType}} + } + +{{/operation}} +{{/operations}} +} 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 new file mode 100644 index 00000000000..483e2c388f8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache @@ -0,0 +1,38 @@ +use reqwest; +use serde_json; + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + return Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + return Error::Serde(e) + } +} + +use super::models::*; + +{{#apiInfo}} +{{#apis}} +mod {{{classFilename}}}; +{{#operations}} +{{#operation}} +{{#-last}} +pub use self::{{{classFilename}}}::{ {{{classname}}}, {{{classname}}}Client }; +{{/-last}} +{{/operation}} +{{/operations}} +{{/apis}} +{{/apiInfo}} + +pub mod configuration; +pub mod client; diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/client.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/client.mustache new file mode 100644 index 00000000000..61765226a26 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/client.mustache @@ -0,0 +1,55 @@ +use std::rc::Rc; + +use super::configuration::Configuration; + +pub struct APIClient { + configuration: Rc, +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#operation}} + {{#-last}} + {{{classFilename}}}: Box<::apis::{{{classname}}}>, + {{/-last}} +{{/operation}} +{{/operations}} +{{/apis}} +{{/apiInfo}} +} + +impl APIClient { + pub fn new(configuration: Configuration) -> APIClient { + let rc = Rc::new(configuration); + + APIClient { + configuration: rc.clone(), +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#operation}} + {{#-last}} + {{{classFilename}}}: Box::new(::apis::{{{classname}}}Client::new(rc.clone())), + {{/-last}} +{{/operation}} +{{/operations}} +{{/apis}} +{{/apiInfo}} + } + } + +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#operation}} +{{#-last}} + pub fn {{{classFilename}}}(&self) -> &::apis::{{{classname}}}{ + self.{{{classFilename}}}.as_ref() + } + +{{/-last}} +{{/operation}} +{{/operations}} +{{/apis}} +{{/apiInfo}} + +} diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache new file mode 100644 index 00000000000..c50ff814e5d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache @@ -0,0 +1,39 @@ +{{>partial_header}} + +use reqwest; + +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "{{{basePath}}}".to_owned(), + user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("Swagger-Codegen/{{{version}}}/rust".to_owned()){{/httpUserAgent}}, + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + api_key: None, + } + } +} diff --git a/pom.xml b/pom.xml index 785535523e7..e6e229d0c19 100644 --- a/pom.xml +++ b/pom.xml @@ -1025,6 +1025,7 @@ samples/client/petstore/elm-0.18 samples/client/petstore/groovy samples/client/petstore/rust + samples/client/petstore/rust-reqwest samples/client/petstore/php/OpenAPIClient-php samples/openapi3/client/petstore/php/OpenAPIClient-php diff --git a/samples/client/petstore/rust-reqwest/.gitignore b/samples/client/petstore/rust-reqwest/.gitignore new file mode 100644 index 00000000000..6aa106405a4 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/samples/client/petstore/rust-reqwest/.openapi-generator-ignore b/samples/client/petstore/rust-reqwest/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION new file mode 100644 index 00000000000..a6527129083 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust-reqwest/.travis.yml b/samples/client/petstore/rust-reqwest/.travis.yml new file mode 100644 index 00000000000..22761ba7ee1 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/samples/client/petstore/rust-reqwest/Cargo.toml b/samples/client/petstore/rust-reqwest/Cargo.toml new file mode 100644 index 00000000000..6d66b8f7c7c --- /dev/null +++ b/samples/client/petstore/rust-reqwest/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "petstore_client" +version = "1.0.0" +authors = ["OpenAPI Generator team and contributors"] + +[dependencies] +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "1.5" +reqwest = "~0.9" + +[dev-dependencies] diff --git a/samples/client/petstore/rust-reqwest/README.md b/samples/client/petstore/rust-reqwest/README.md new file mode 100644 index 00000000000..9d256c59927 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/README.md @@ -0,0 +1,97 @@ +# Rust API client for petstore_client + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.RustClientCodegen + +## Installation +Put the package under your project folder and add the following in import: +``` + "./petstore_client" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **post** /pet | Add a new pet to the store +*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **put** /pet | Update an existing pet +*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **delete** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **get** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **post** /store/order | Place an order for a pet +*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **post** /user | Create user +*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **delete** /user/{username} | Delete user +*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **get** /user/{username} | Get user by user name +*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **get** /user/login | Logs user into the system +*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **put** /user/{username} | Updated user + + +## Documentation For Models + + - [ApiResponse](docs/ApiResponse.md) + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + +## api_key +- **Type**: API key + +Example +``` + auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. + }) + r, err := client.Service.Operation(auth, args) +``` +## petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +Example +``` + auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING") + r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. +``` + import "golang.org/x/oauth2" + + / .. Perform OAuth2 round trip request and obtain a token .. // + + tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) + auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) + r, err := client.Service.Operation(auth, args) +``` + +## Author + + + diff --git a/samples/client/petstore/rust-reqwest/docs/ApiResponse.md b/samples/client/petstore/rust-reqwest/docs/ApiResponse.md new file mode 100644 index 00000000000..3af9a16ab36 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **i32** | | [optional] +**_type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/Category.md b/samples/client/petstore/rust-reqwest/docs/Category.md new file mode 100644 index 00000000000..39aaee2b052 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i64** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/Order.md b/samples/client/petstore/rust-reqwest/docs/Order.md new file mode 100644 index 00000000000..f350a8b5b4e --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i64** | | [optional] +**pet_id** | **i64** | | [optional] +**quantity** | **i32** | | [optional] +**ship_date** | **String** | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/Pet.md b/samples/client/petstore/rust-reqwest/docs/Pet.md new file mode 100644 index 00000000000..097c4390288 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i64** | | [optional] +**category** | [***::models::Category**](Category.md) | | [optional] +**name** | **String** | | +**photo_urls** | **Vec** | | +**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/PetApi.md b/samples/client/petstore/rust-reqwest/docs/PetApi.md new file mode 100644 index 00000000000..ea3b5825627 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/PetApi.md @@ -0,0 +1,259 @@ +# \PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_pet**](PetApi.md#add_pet) | **post** /pet | Add a new pet to the store +[**delete_pet**](PetApi.md#delete_pet) | **delete** /pet/{petId} | Deletes a pet +[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **get** /pet/findByStatus | Finds Pets by status +[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **get** /pet/findByTags | Finds Pets by tags +[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **get** /pet/{petId} | Find pet by ID +[**update_pet**](PetApi.md#update_pet) | **put** /pet | Update an existing pet +[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **post** /pet/{petId} | Updates a pet in the store with form data +[**upload_file**](PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image + + +# **add_pet** +> add_pet(ctx, pet) +Add a new pet to the store + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_pet** +> delete_pet(ctx, pet_id, optional) +Deletes a pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet_id** | **i64**| Pet id to delete | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **i64**| Pet id to delete | + **api_key** | **String**| | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_status** +> Vec<::models::Pet> find_pets_by_status(ctx, status) +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **status** | [**Vec**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**Vec<::models::Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_tags** +> Vec<::models::Pet> find_pets_by_tags(ctx, tags) +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **tags** | [**Vec**](String.md)| Tags to filter by | + +### Return type + +[**Vec<::models::Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id** +> ::models::Pet get_pet_by_id(ctx, pet_id) +Find pet by ID + +Returns a single pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet_id** | **i64**| ID of pet to return | + +### Return type + +[**::models::Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet** +> update_pet(ctx, pet) +Update an existing pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet_with_form** +> update_pet_with_form(ctx, pet_id, optional) +Updates a pet in the store with form data + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet_id** | **i64**| ID of pet that needs to be updated | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **i64**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | + **status** | **String**| Updated status of the pet | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> ::models::ApiResponse upload_file(ctx, pet_id, optional) +uploads an image + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context containing the authentication | nil if no authentication + **pet_id** | **i64**| ID of pet to update | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **i64**| ID of pet to update | + **additional_metadata** | **String**| Additional data to pass to server | + **file** | **::models::File**| file to upload | + +### Return type + +[**::models::ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/rust-reqwest/docs/StoreApi.md b/samples/client/petstore/rust-reqwest/docs/StoreApi.md new file mode 100644 index 00000000000..a4555a25565 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/StoreApi.md @@ -0,0 +1,115 @@ +# \StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_order**](StoreApi.md#delete_order) | **delete** /store/order/{orderId} | Delete purchase order by ID +[**get_inventory**](StoreApi.md#get_inventory) | **get** /store/inventory | Returns pet inventories by status +[**get_order_by_id**](StoreApi.md#get_order_by_id) | **get** /store/order/{orderId} | Find purchase order by ID +[**place_order**](StoreApi.md#place_order) | **post** /store/order | Place an order for a pet + + +# **delete_order** +> delete_order(order_id) +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **String**| ID of the order that needs to be deleted | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory** +> ::std::collections::HashMap get_inventory(ctx, ) +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +**::std::collections::HashMap** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_order_by_id** +> ::models::Order get_order_by_id(order_id) +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **i64**| ID of pet that needs to be fetched | + +### Return type + +[**::models::Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **place_order** +> ::models::Order place_order(order) +Place an order for a pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**::models::Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/rust-reqwest/docs/Tag.md b/samples/client/petstore/rust-reqwest/docs/Tag.md new file mode 100644 index 00000000000..d1118479b90 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i64** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/User.md b/samples/client/petstore/rust-reqwest/docs/User.md new file mode 100644 index 00000000000..33aa9693902 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **i64** | | [optional] +**username** | **String** | | [optional] +**first_name** | **String** | | [optional] +**last_name** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**user_status** | **i32** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust-reqwest/docs/UserApi.md b/samples/client/petstore/rust-reqwest/docs/UserApi.md new file mode 100644 index 00000000000..05d2aeccaa3 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/docs/UserApi.md @@ -0,0 +1,221 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_user**](UserApi.md#create_user) | **post** /user | Create user +[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **post** /user/createWithArray | Creates list of users with given input array +[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **post** /user/createWithList | Creates list of users with given input array +[**delete_user**](UserApi.md#delete_user) | **delete** /user/{username} | Delete user +[**get_user_by_name**](UserApi.md#get_user_by_name) | **get** /user/{username} | Get user by user name +[**login_user**](UserApi.md#login_user) | **get** /user/login | Logs user into the system +[**logout_user**](UserApi.md#logout_user) | **get** /user/logout | Logs out current logged in user session +[**update_user**](UserApi.md#update_user) | **put** /user/{username} | Updated user + + +# **create_user** +> create_user(user) +Create user + +This can only be done by the logged in user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_array_input** +> create_users_with_array_input(user) +Creates list of users with given input array + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**Vec<::models::User>**](array.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_list_input** +> create_users_with_list_input(user) +Creates list of users with given input array + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**Vec<::models::User>**](array.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_user** +> delete_user(username) +Delete user + +This can only be done by the logged in user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_user_by_name** +> ::models::User get_user_by_name(username) +Get user by user name + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**::models::User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **login_user** +> String login_user(username, password) +Logs user into the system + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logout_user** +> logout_user() +Logs out current logged in user session + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_user** +> update_user(username, user) +Updated user + +This can only be done by the logged in user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/rust-reqwest/git_push.sh b/samples/client/petstore/rust-reqwest/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/rust-reqwest/pom.xml b/samples/client/petstore/rust-reqwest/pom.xml new file mode 100644 index 00000000000..299a9058f7c --- /dev/null +++ b/samples/client/petstore/rust-reqwest/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + RustReqwestPetstoreClientTests + pom + 1.0-SNAPSHOT + Rust Reqwest Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-test + integration-test + + exec + + + cargo + + check + + + + + + + + diff --git a/samples/client/petstore/rust-reqwest/src/apis/client.rs b/samples/client/petstore/rust-reqwest/src/apis/client.rs new file mode 100644 index 00000000000..4b4f29ce08b --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/client.rs @@ -0,0 +1,37 @@ +use std::rc::Rc; + +use super::configuration::Configuration; + +pub struct APIClient { + configuration: Rc, + pet_api: Box<::apis::PetApi>, + store_api: Box<::apis::StoreApi>, + user_api: Box<::apis::UserApi>, +} + +impl APIClient { + pub fn new(configuration: Configuration) -> APIClient { + let rc = Rc::new(configuration); + + APIClient { + configuration: rc.clone(), + pet_api: Box::new(::apis::PetApiClient::new(rc.clone())), + store_api: Box::new(::apis::StoreApiClient::new(rc.clone())), + user_api: Box::new(::apis::UserApiClient::new(rc.clone())), + } + } + + pub fn pet_api(&self) -> &::apis::PetApi{ + self.pet_api.as_ref() + } + + pub fn store_api(&self) -> &::apis::StoreApi{ + self.store_api.as_ref() + } + + pub fn user_api(&self) -> &::apis::UserApi{ + self.user_api.as_ref() + } + + +} diff --git a/samples/client/petstore/rust-reqwest/src/apis/configuration.rs b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs new file mode 100644 index 00000000000..c6c5ee8519b --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://petstore.swagger.io/v2".to_owned(), + user_agent: Some("Swagger-Codegen/1.0.0/rust".to_owned()), + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + api_key: None, + } + } +} diff --git a/samples/client/petstore/rust-reqwest/src/apis/mod.rs b/samples/client/petstore/rust-reqwest/src/apis/mod.rs new file mode 100644 index 00000000000..7494e25ce9e --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/mod.rs @@ -0,0 +1,32 @@ +use reqwest; +use serde_json; + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + return Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + return Error::Serde(e) + } +} + +use super::models::*; + +mod pet_api; +pub use self::pet_api::{ PetApi, PetApiClient }; +mod store_api; +pub use self::store_api::{ StoreApi, StoreApiClient }; +mod user_api; +pub use self::user_api::{ UserApi, UserApiClient }; + +pub mod configuration; +pub mod client; diff --git a/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs new file mode 100644 index 00000000000..7771c6568d6 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs @@ -0,0 +1,298 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; + +use reqwest; + +use super::{Error, configuration}; + +pub struct PetApiClient { + configuration: Rc, +} + +impl PetApiClient { + pub fn new(configuration: Rc) -> PetApiClient { + PetApiClient { + configuration: configuration, + } + } +} + +pub trait PetApi { + fn add_pet(&self, pet: ::models::Pet) -> Result<(), Error>; + fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error>; + fn find_pets_by_status(&self, status: Vec) -> Result, Error>; + fn find_pets_by_tags(&self, tags: Vec) -> Result, Error>; + fn get_pet_by_id(&self, pet_id: i64) -> Result<::models::Pet, Error>; + fn update_pet(&self, pet: ::models::Pet) -> Result<(), Error>; + fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>; + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Result<::models::ApiResponse, Error>; +} + + +impl PetApi for PetApiClient { + fn add_pet(&self, pet: ::models::Pet) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet?{}", configuration.base_path, query_string); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + req_builder = req_builder.json(&pet); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id); + + let mut req_builder = client.delete(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + req_builder = req_builder.header("api_key", api_key.to_string()); + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn find_pets_by_status(&self, status: Vec) -> Result, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + query.append_pair("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string()); + + query.finish() + }; + let uri_str = format!("{}/pet/findByStatus?{}", configuration.base_path, query_string); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn find_pets_by_tags(&self, tags: Vec) -> Result, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + query.append_pair("tags", &tags.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string()); + + query.finish() + }; + let uri_str = format!("{}/pet/findByTags?{}", configuration.base_path, query_string); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn get_pet_by_id(&self, pet_id: i64) -> Result<::models::Pet, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let val = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("api_key", val); + }; + + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn update_pet(&self, pet: ::models::Pet) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet?{}", configuration.base_path, query_string); + + let mut req_builder = client.put(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + req_builder = req_builder.json(&pet); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Result<::models::ApiResponse, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/pet/{petId}/uploadImage?{}", configuration.base_path, query_string, petId=pet_id); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref token) = configuration.oauth_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + +} diff --git a/samples/client/petstore/rust-reqwest/src/apis/store_api.rs b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs new file mode 100644 index 00000000000..90a719df929 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs @@ -0,0 +1,155 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; + +use reqwest; + +use super::{Error, configuration}; + +pub struct StoreApiClient { + configuration: Rc, +} + +impl StoreApiClient { + pub fn new(configuration: Rc) -> StoreApiClient { + StoreApiClient { + configuration: configuration, + } + } +} + +pub trait StoreApi { + fn delete_order(&self, order_id: &str) -> Result<(), Error>; + fn get_inventory(&self, ) -> Result<::std::collections::HashMap, Error>; + fn get_order_by_id(&self, order_id: i64) -> Result<::models::Order, Error>; + fn place_order(&self, order: ::models::Order) -> Result<::models::Order, Error>; +} + + +impl StoreApi for StoreApiClient { + fn delete_order(&self, order_id: &str) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/store/order/{orderId}?{}", configuration.base_path, query_string, orderId=order_id); + + let mut req_builder = client.delete(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn get_inventory(&self, ) -> Result<::std::collections::HashMap, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/store/inventory?{}", configuration.base_path, query_string); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let val = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("api_key", val); + }; + + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn get_order_by_id(&self, order_id: i64) -> Result<::models::Order, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/store/order/{orderId}?{}", configuration.base_path, query_string, orderId=order_id); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn place_order(&self, order: ::models::Order) -> Result<::models::Order, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/store/order?{}", configuration.base_path, query_string); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + req_builder = req_builder.json(&order); + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + +} diff --git a/samples/client/petstore/rust-reqwest/src/apis/user_api.rs b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs new file mode 100644 index 00000000000..8d14e2dc5ce --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs @@ -0,0 +1,263 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; + +use reqwest; + +use super::{Error, configuration}; + +pub struct UserApiClient { + configuration: Rc, +} + +impl UserApiClient { + pub fn new(configuration: Rc) -> UserApiClient { + UserApiClient { + configuration: configuration, + } + } +} + +pub trait UserApi { + fn create_user(&self, user: ::models::User) -> Result<(), Error>; + fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Result<(), Error>; + fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Result<(), Error>; + fn delete_user(&self, username: &str) -> Result<(), Error>; + fn get_user_by_name(&self, username: &str) -> Result<::models::User, Error>; + fn login_user(&self, username: &str, password: &str) -> Result; + fn logout_user(&self, ) -> Result<(), Error>; + fn update_user(&self, username: &str, user: ::models::User) -> Result<(), Error>; +} + + +impl UserApi for UserApiClient { + fn create_user(&self, user: ::models::User) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user?{}", configuration.base_path, query_string); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + req_builder = req_builder.json(&user); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/createWithArray?{}", configuration.base_path, query_string); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + req_builder = req_builder.json(&user); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/createWithList?{}", configuration.base_path, query_string); + + let mut req_builder = client.post(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + req_builder = req_builder.json(&user); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn delete_user(&self, username: &str) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username); + + let mut req_builder = client.delete(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn get_user_by_name(&self, username: &str) -> Result<::models::User, Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn login_user(&self, username: &str, password: &str) -> Result { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + query.append_pair("username", &username.to_string()); + query.append_pair("password", &password.to_string()); + + query.finish() + }; + let uri_str = format!("{}/user/login?{}", configuration.base_path, query_string); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + Ok(client.execute(req)?.error_for_status()?.json()?) + } + + fn logout_user(&self, ) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/logout?{}", configuration.base_path, query_string); + + let mut req_builder = client.get(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + + fn update_user(&self, username: &str, user: ::models::User) -> Result<(), Error> { + let configuration: &configuration::Configuration = self.configuration.borrow(); + let client = &configuration.client; + + let query_string = { + let mut query = ::url::form_urlencoded::Serializer::new(String::new()); + + query.finish() + }; + let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username); + + let mut req_builder = client.put(uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + + + req_builder = req_builder.json(&user); + + // send request + let req = req_builder.build()?; + + client.execute(req)?.error_for_status()?; + Ok(()) + } + +} diff --git a/modules/openapi-generator/src/main/resources/rust/lib.rs b/samples/client/petstore/rust-reqwest/src/lib.rs similarity index 76% rename from modules/openapi-generator/src/main/resources/rust/lib.rs rename to samples/client/petstore/rust-reqwest/src/lib.rs index b51fea8150e..c1dd666f795 100644 --- a/modules/openapi-generator/src/main/resources/rust/lib.rs +++ b/samples/client/petstore/rust-reqwest/src/lib.rs @@ -1,11 +1,10 @@ #[macro_use] extern crate serde_derive; -extern crate hyper; extern crate serde; extern crate serde_json; -extern crate futures; extern crate url; +extern crate reqwest; pub mod apis; pub mod models; diff --git a/samples/client/petstore/rust-reqwest/src/models/api_response.rs b/samples/client/petstore/rust-reqwest/src/models/api_response.rs new file mode 100644 index 00000000000..0c9de96d442 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/api_response.rs @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// ApiResponse : Describes the result of uploading an image resource + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct ApiResponse { + #[serde(rename = "code")] + code: Option, + #[serde(rename = "type")] + _type: Option, + #[serde(rename = "message")] + message: Option +} + +impl ApiResponse { + /// Describes the result of uploading an image resource + pub fn new() -> ApiResponse { + ApiResponse { + code: None, + _type: None, + message: None + } + } + + pub fn set_code(&mut self, code: i32) { + self.code = Some(code); + } + + pub fn with_code(mut self, code: i32) -> ApiResponse { + self.code = Some(code); + self + } + + pub fn code(&self) -> Option<&i32> { + self.code.as_ref() + } + + pub fn reset_code(&mut self) { + self.code = None; + } + + pub fn set__type(&mut self, _type: String) { + self._type = Some(_type); + } + + pub fn with__type(mut self, _type: String) -> ApiResponse { + self._type = Some(_type); + self + } + + pub fn _type(&self) -> Option<&String> { + self._type.as_ref() + } + + pub fn reset__type(&mut self) { + self._type = None; + } + + pub fn set_message(&mut self, message: String) { + self.message = Some(message); + } + + pub fn with_message(mut self, message: String) -> ApiResponse { + self.message = Some(message); + self + } + + pub fn message(&self) -> Option<&String> { + self.message.as_ref() + } + + pub fn reset_message(&mut self) { + self.message = None; + } + +} + + + diff --git a/samples/client/petstore/rust-reqwest/src/models/category.rs b/samples/client/petstore/rust-reqwest/src/models/category.rs new file mode 100644 index 00000000000..5a9e1b98366 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/category.rs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// Category : A category for a pet + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Category { + #[serde(rename = "id")] + id: Option, + #[serde(rename = "name")] + name: Option +} + +impl Category { + /// A category for a pet + pub fn new() -> Category { + Category { + id: None, + name: None + } + } + + pub fn set_id(&mut self, id: i64) { + self.id = Some(id); + } + + pub fn with_id(mut self, id: i64) -> Category { + self.id = Some(id); + self + } + + pub fn id(&self) -> Option<&i64> { + self.id.as_ref() + } + + pub fn reset_id(&mut self) { + self.id = None; + } + + pub fn set_name(&mut self, name: String) { + self.name = Some(name); + } + + pub fn with_name(mut self, name: String) -> Category { + self.name = Some(name); + self + } + + pub fn name(&self) -> Option<&String> { + self.name.as_ref() + } + + pub fn reset_name(&mut self) { + self.name = None; + } + +} + + + diff --git a/samples/client/petstore/rust-reqwest/src/models/mod.rs b/samples/client/petstore/rust-reqwest/src/models/mod.rs new file mode 100644 index 00000000000..b24024670b2 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/mod.rs @@ -0,0 +1,15 @@ +mod api_response; +pub use self::api_response::ApiResponse; +mod category; +pub use self::category::Category; +mod order; +pub use self::order::Order; +mod pet; +pub use self::pet::Pet; +mod tag; +pub use self::tag::Tag; +mod user; +pub use self::user::User; + +// TODO(farcaller): sort out files +pub struct File; diff --git a/samples/client/petstore/rust-reqwest/src/models/order.rs b/samples/client/petstore/rust-reqwest/src/models/order.rs new file mode 100644 index 00000000000..1e88b0beced --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/order.rs @@ -0,0 +1,151 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// Order : An order for a pets from the pet store + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Order { + #[serde(rename = "id")] + id: Option, + #[serde(rename = "petId")] + pet_id: Option, + #[serde(rename = "quantity")] + quantity: Option, + #[serde(rename = "shipDate")] + ship_date: Option, + /// Order Status + #[serde(rename = "status")] + status: Option, + #[serde(rename = "complete")] + complete: Option +} + +impl Order { + /// An order for a pets from the pet store + pub fn new() -> Order { + Order { + id: None, + pet_id: None, + quantity: None, + ship_date: None, + status: None, + complete: None + } + } + + pub fn set_id(&mut self, id: i64) { + self.id = Some(id); + } + + pub fn with_id(mut self, id: i64) -> Order { + self.id = Some(id); + self + } + + pub fn id(&self) -> Option<&i64> { + self.id.as_ref() + } + + pub fn reset_id(&mut self) { + self.id = None; + } + + pub fn set_pet_id(&mut self, pet_id: i64) { + self.pet_id = Some(pet_id); + } + + pub fn with_pet_id(mut self, pet_id: i64) -> Order { + self.pet_id = Some(pet_id); + self + } + + pub fn pet_id(&self) -> Option<&i64> { + self.pet_id.as_ref() + } + + pub fn reset_pet_id(&mut self) { + self.pet_id = None; + } + + pub fn set_quantity(&mut self, quantity: i32) { + self.quantity = Some(quantity); + } + + pub fn with_quantity(mut self, quantity: i32) -> Order { + self.quantity = Some(quantity); + self + } + + pub fn quantity(&self) -> Option<&i32> { + self.quantity.as_ref() + } + + pub fn reset_quantity(&mut self) { + self.quantity = None; + } + + pub fn set_ship_date(&mut self, ship_date: String) { + self.ship_date = Some(ship_date); + } + + pub fn with_ship_date(mut self, ship_date: String) -> Order { + self.ship_date = Some(ship_date); + self + } + + pub fn ship_date(&self) -> Option<&String> { + self.ship_date.as_ref() + } + + pub fn reset_ship_date(&mut self) { + self.ship_date = None; + } + + pub fn set_status(&mut self, status: String) { + self.status = Some(status); + } + + pub fn with_status(mut self, status: String) -> Order { + self.status = Some(status); + self + } + + pub fn status(&self) -> Option<&String> { + self.status.as_ref() + } + + pub fn reset_status(&mut self) { + self.status = None; + } + + pub fn set_complete(&mut self, complete: bool) { + self.complete = Some(complete); + } + + pub fn with_complete(mut self, complete: bool) -> Order { + self.complete = Some(complete); + self + } + + pub fn complete(&self) -> Option<&bool> { + self.complete.as_ref() + } + + pub fn reset_complete(&mut self) { + self.complete = None; + } + +} + + + diff --git a/samples/client/petstore/rust-reqwest/src/models/pet.rs b/samples/client/petstore/rust-reqwest/src/models/pet.rs new file mode 100644 index 00000000000..6407103eeb1 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/pet.rs @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// Pet : A pet for sale in the pet store + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Pet { + #[serde(rename = "id")] + id: Option, + #[serde(rename = "category")] + category: Option<::models::Category>, + #[serde(rename = "name")] + name: String, + #[serde(rename = "photoUrls")] + photo_urls: Vec, + #[serde(rename = "tags")] + tags: Option>, + /// pet status in the store + #[serde(rename = "status")] + status: Option +} + +impl Pet { + /// A pet for sale in the pet store + pub fn new(name: String, photo_urls: Vec) -> Pet { + Pet { + id: None, + category: None, + name: name, + photo_urls: photo_urls, + tags: None, + status: None + } + } + + pub fn set_id(&mut self, id: i64) { + self.id = Some(id); + } + + pub fn with_id(mut self, id: i64) -> Pet { + self.id = Some(id); + self + } + + pub fn id(&self) -> Option<&i64> { + self.id.as_ref() + } + + pub fn reset_id(&mut self) { + self.id = None; + } + + pub fn set_category(&mut self, category: ::models::Category) { + self.category = Some(category); + } + + pub fn with_category(mut self, category: ::models::Category) -> Pet { + self.category = Some(category); + self + } + + pub fn category(&self) -> Option<&::models::Category> { + self.category.as_ref() + } + + pub fn reset_category(&mut self) { + self.category = None; + } + + pub fn set_name(&mut self, name: String) { + self.name = name; + } + + pub fn with_name(mut self, name: String) -> Pet { + self.name = name; + self + } + + pub fn name(&self) -> &String { + &self.name + } + + + pub fn set_photo_urls(&mut self, photo_urls: Vec) { + self.photo_urls = photo_urls; + } + + pub fn with_photo_urls(mut self, photo_urls: Vec) -> Pet { + self.photo_urls = photo_urls; + self + } + + pub fn photo_urls(&self) -> &Vec { + &self.photo_urls + } + + + pub fn set_tags(&mut self, tags: Vec<::models::Tag>) { + self.tags = Some(tags); + } + + pub fn with_tags(mut self, tags: Vec<::models::Tag>) -> Pet { + self.tags = Some(tags); + self + } + + pub fn tags(&self) -> Option<&Vec<::models::Tag>> { + self.tags.as_ref() + } + + pub fn reset_tags(&mut self) { + self.tags = None; + } + + pub fn set_status(&mut self, status: String) { + self.status = Some(status); + } + + pub fn with_status(mut self, status: String) -> Pet { + self.status = Some(status); + self + } + + pub fn status(&self) -> Option<&String> { + self.status.as_ref() + } + + pub fn reset_status(&mut self) { + self.status = None; + } + +} + + + diff --git a/samples/client/petstore/rust-reqwest/src/models/tag.rs b/samples/client/petstore/rust-reqwest/src/models/tag.rs new file mode 100644 index 00000000000..a698451706b --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/tag.rs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// Tag : A tag for a pet + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Tag { + #[serde(rename = "id")] + id: Option, + #[serde(rename = "name")] + name: Option +} + +impl Tag { + /// A tag for a pet + pub fn new() -> Tag { + Tag { + id: None, + name: None + } + } + + pub fn set_id(&mut self, id: i64) { + self.id = Some(id); + } + + pub fn with_id(mut self, id: i64) -> Tag { + self.id = Some(id); + self + } + + pub fn id(&self) -> Option<&i64> { + self.id.as_ref() + } + + pub fn reset_id(&mut self) { + self.id = None; + } + + pub fn set_name(&mut self, name: String) { + self.name = Some(name); + } + + pub fn with_name(mut self, name: String) -> Tag { + self.name = Some(name); + self + } + + pub fn name(&self) -> Option<&String> { + self.name.as_ref() + } + + pub fn reset_name(&mut self) { + self.name = None; + } + +} + + + diff --git a/samples/client/petstore/rust-reqwest/src/models/user.rs b/samples/client/petstore/rust-reqwest/src/models/user.rs new file mode 100644 index 00000000000..6c83a23e250 --- /dev/null +++ b/samples/client/petstore/rust-reqwest/src/models/user.rs @@ -0,0 +1,191 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// User : A User who is purchasing from the pet store + +#[allow(unused_imports)] +use serde_json::Value; + +#[derive(Debug, Serialize, Deserialize)] +pub struct User { + #[serde(rename = "id")] + id: Option, + #[serde(rename = "username")] + username: Option, + #[serde(rename = "firstName")] + first_name: Option, + #[serde(rename = "lastName")] + last_name: Option, + #[serde(rename = "email")] + email: Option, + #[serde(rename = "password")] + password: Option, + #[serde(rename = "phone")] + phone: Option, + /// User Status + #[serde(rename = "userStatus")] + user_status: Option +} + +impl User { + /// A User who is purchasing from the pet store + pub fn new() -> User { + User { + id: None, + username: None, + first_name: None, + last_name: None, + email: None, + password: None, + phone: None, + user_status: None + } + } + + pub fn set_id(&mut self, id: i64) { + self.id = Some(id); + } + + pub fn with_id(mut self, id: i64) -> User { + self.id = Some(id); + self + } + + pub fn id(&self) -> Option<&i64> { + self.id.as_ref() + } + + pub fn reset_id(&mut self) { + self.id = None; + } + + pub fn set_username(&mut self, username: String) { + self.username = Some(username); + } + + pub fn with_username(mut self, username: String) -> User { + self.username = Some(username); + self + } + + pub fn username(&self) -> Option<&String> { + self.username.as_ref() + } + + pub fn reset_username(&mut self) { + self.username = None; + } + + pub fn set_first_name(&mut self, first_name: String) { + self.first_name = Some(first_name); + } + + pub fn with_first_name(mut self, first_name: String) -> User { + self.first_name = Some(first_name); + self + } + + pub fn first_name(&self) -> Option<&String> { + self.first_name.as_ref() + } + + pub fn reset_first_name(&mut self) { + self.first_name = None; + } + + pub fn set_last_name(&mut self, last_name: String) { + self.last_name = Some(last_name); + } + + pub fn with_last_name(mut self, last_name: String) -> User { + self.last_name = Some(last_name); + self + } + + pub fn last_name(&self) -> Option<&String> { + self.last_name.as_ref() + } + + pub fn reset_last_name(&mut self) { + self.last_name = None; + } + + pub fn set_email(&mut self, email: String) { + self.email = Some(email); + } + + pub fn with_email(mut self, email: String) -> User { + self.email = Some(email); + self + } + + pub fn email(&self) -> Option<&String> { + self.email.as_ref() + } + + pub fn reset_email(&mut self) { + self.email = None; + } + + pub fn set_password(&mut self, password: String) { + self.password = Some(password); + } + + pub fn with_password(mut self, password: String) -> User { + self.password = Some(password); + self + } + + pub fn password(&self) -> Option<&String> { + self.password.as_ref() + } + + pub fn reset_password(&mut self) { + self.password = None; + } + + pub fn set_phone(&mut self, phone: String) { + self.phone = Some(phone); + } + + pub fn with_phone(mut self, phone: String) -> User { + self.phone = Some(phone); + self + } + + pub fn phone(&self) -> Option<&String> { + self.phone.as_ref() + } + + pub fn reset_phone(&mut self) { + self.phone = None; + } + + pub fn set_user_status(&mut self, user_status: i32) { + self.user_status = Some(user_status); + } + + pub fn with_user_status(mut self, user_status: i32) -> User { + self.user_status = Some(user_status); + self + } + + pub fn user_status(&self) -> Option<&i32> { + self.user_status.as_ref() + } + + pub fn reset_user_status(&mut self) { + self.user_status = None; + } + +} + + + diff --git a/samples/client/petstore/rust/.openapi-generator/VERSION b/samples/client/petstore/rust/.openapi-generator/VERSION index a0cd9f0ccb0..a6527129083 100644 --- a/samples/client/petstore/rust/.openapi-generator/VERSION +++ b/samples/client/petstore/rust/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust/Cargo.toml b/samples/client/petstore/rust/Cargo.toml index 29cb240bc50..2ccdd989058 100644 --- a/samples/client/petstore/rust/Cargo.toml +++ b/samples/client/petstore/rust/Cargo.toml @@ -4,14 +4,14 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] [dependencies] -serde = "1.0" -serde_derive = "1.0" -serde_yaml = "0.7" -serde_json = "1.0" -base64 = "~0.7.0" -futures = "0.1.16" -hyper = "0.11.6" +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" url = "1.5" +hyper = "~0.11" +serde_yaml = "0.7" +base64 = "~0.7.0" +futures = "0.1.23" [dev-dependencies] tokio-core = "*" diff --git a/samples/client/petstore/rust/docs/PetApi.md b/samples/client/petstore/rust/docs/PetApi.md index 716a3c04d0a..333648af894 100644 --- a/samples/client/petstore/rust/docs/PetApi.md +++ b/samples/client/petstore/rust/docs/PetApi.md @@ -86,7 +86,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication - **status** | [**Vec<String>**](String.md)| Status values that need to be considered for filter | + **status** | [**Vec**](String.md)| Status values that need to be considered for filter | ### Return type @@ -114,7 +114,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication - **tags** | [**Vec<String>**](String.md)| Tags to filter by | + **tags** | [**Vec**](String.md)| Tags to filter by | ### Return type diff --git a/samples/client/petstore/rust/docs/UserApi.md b/samples/client/petstore/rust/docs/UserApi.md index 91f2368dfb6..ea16bc1218e 100644 --- a/samples/client/petstore/rust/docs/UserApi.md +++ b/samples/client/petstore/rust/docs/UserApi.md @@ -49,7 +49,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Vec<::models::User>**](array.md)| List of user object | + **user** | [**Vec<::models::User>**](array.md)| List of user object | ### Return type @@ -74,7 +74,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Vec<::models::User>**](array.md)| List of user object | + **user** | [**Vec<::models::User>**](array.md)| List of user object | ### Return type diff --git a/samples/client/petstore/rust/pom.xml b/samples/client/petstore/rust/pom.xml index 1b803f27b0e..86adf2289ec 100644 --- a/samples/client/petstore/rust/pom.xml +++ b/samples/client/petstore/rust/pom.xml @@ -35,8 +35,7 @@ cargo - build - --release + check diff --git a/samples/client/petstore/rust/src/lib.rs b/samples/client/petstore/rust/src/lib.rs index b51fea8150e..a76d822525d 100644 --- a/samples/client/petstore/rust/src/lib.rs +++ b/samples/client/petstore/rust/src/lib.rs @@ -1,11 +1,11 @@ #[macro_use] extern crate serde_derive; -extern crate hyper; extern crate serde; extern crate serde_json; -extern crate futures; extern crate url; +extern crate hyper; +extern crate futures; pub mod apis; pub mod models; From ed8433a849af79690025b49c968f9a9804990245 Mon Sep 17 00:00:00 2001 From: John Wang Date: Fri, 26 Oct 2018 18:10:59 +0800 Subject: [PATCH 32/35] [Golang][client] fix response decode error handling (#1291) * handle and return API response decode error * ensure-up-to-date * refactor go/api.mustache for easier readability * disable error reporting for TestPlaceOrder with invalid RFC 3339 `+0000` UTC offset present in Petstore test server --- .../src/main/resources/go/api.mustache | 21 ++--- .../go/go-petstore/api_another_fake.go | 17 ++-- .../petstore/go/go-petstore/api_fake.go | 85 ++++++++++--------- .../go-petstore/api_fake_classname_tags123.go | 17 ++-- .../client/petstore/go/go-petstore/api_pet.go | 85 ++++++++++--------- .../petstore/go/go-petstore/api_store.go | 51 +++++------ .../petstore/go/go-petstore/api_user.go | 34 ++++---- samples/client/petstore/go/store_api_test.go | 11 ++- 8 files changed, 174 insertions(+), 147 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index 19cde5b4458..175962642dd 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -272,16 +272,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err } - {{#returnType}} - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err - } - } - - {{/returnType}} if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -304,6 +294,17 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr } + {{#returnType}} + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr + } + + {{/returnType}} return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, nil } {{/operation}} diff --git a/samples/client/petstore/go/go-petstore/api_another_fake.go b/samples/client/petstore/go/go-petstore/api_another_fake.go index a7a6f1f75c3..f74f5bffd55 100644 --- a/samples/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore/api_another_fake.go @@ -83,14 +83,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -109,5 +101,14 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index f0ba3d30165..949b14bf876 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -94,14 +94,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -120,6 +112,15 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -195,14 +196,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -221,6 +214,15 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -292,14 +294,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -318,6 +312,15 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -389,14 +392,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -415,6 +410,15 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -614,14 +618,6 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -640,6 +636,15 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go index 1b55b578de8..05416e6a2fb 100644 --- a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -96,14 +96,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -122,5 +114,14 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore/api_pet.go b/samples/client/petstore/go/go-petstore/api_pet.go index f328c787e20..04813836bb7 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -228,14 +228,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -254,6 +246,15 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -315,14 +316,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -341,6 +334,15 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -415,14 +417,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -441,6 +435,15 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -676,14 +679,6 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -702,6 +697,15 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -781,14 +785,6 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -807,5 +803,14 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore/api_store.go b/samples/client/petstore/go/go-petstore/api_store.go index a6844520895..6b9fc4bd17e 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -161,14 +161,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -187,6 +179,15 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -254,14 +255,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -280,6 +273,15 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -341,14 +343,6 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -367,5 +361,14 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore/api_user.go b/samples/client/petstore/go/go-petstore/api_user.go index f1401adfb45..f3d0af8200a 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -351,14 +351,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -377,6 +369,15 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -439,14 +440,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -465,6 +458,15 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/store_api_test.go b/samples/client/petstore/go/store_api_test.go index 0e1a2f06c6f..72191d0dd61 100644 --- a/samples/client/petstore/go/store_api_test.go +++ b/samples/client/petstore/go/store_api_test.go @@ -2,6 +2,7 @@ package main import ( "context" + "regexp" "testing" "time" @@ -20,7 +21,15 @@ func TestPlaceOrder(t *testing.T) { _, r, err := client.StoreApi.PlaceOrder(context.Background(), newOrder) if err != nil { - t.Errorf("Error while placing order") + // Skip parsing time error due to error in Petstore Test Server + // https://github.com/OpenAPITools/openapi-generator/issues/1292 + if regexp. + MustCompile(`^parsing time.+cannot parse "\+0000"" as "Z07:00"$`). + MatchString(err.Error()) { + t.Log("Skipping error for parsing time with `+0000` UTC offset as Petstore Test Server does not return valid RFC 3339 datetime") + } else { + t.Errorf("Error while placing order") + } t.Log(err) } if r.StatusCode != 200 { From 1b115bb4f7d37a5eda4b73c8089fa2cb94ddc64f Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Fri, 26 Oct 2018 12:20:36 +0200 Subject: [PATCH 33/35] [elm] Add flag to prefix custom type variants (#1288) --- bin/openapi3/elm-petstore.sh | 2 +- .../codegen/languages/ElmClientCodegen.java | 35 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/bin/openapi3/elm-petstore.sh b/bin/openapi3/elm-petstore.sh index 9090d50a87f..da073a5ea5c 100755 --- a/bin/openapi3/elm-petstore.sh +++ b/bin/openapi3/elm-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g elm -o samples/client/petstore/elm $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g elm -t modules/openapi-generator/src/main/resources/elm -o samples/openapi3/client/petstore/elm --additional-properties elmPrefixCustomTypeVariants=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java index f710d426c2d..07d06a03b04 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java @@ -59,8 +59,10 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ElmClientCodegen.class); private Set customPrimitives = new HashSet(); private ElmVersion elmVersion = ElmVersion.ELM_019; + private Boolean elmPrefixCustomTypeVariants = false; private static final String ELM_VERSION = "elmVersion"; + private static final String ELM_PREFIX_CUSTOM_TYPE_VARIANTS = "elmPrefixCustomTypeVariants"; private static final String ENCODER = "elmEncoder"; private static final String DECODER = "elmDecoder"; private static final String DISCRIMINATOR_NAME = "discriminatorName"; @@ -162,13 +164,14 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { supportedVersions.put("0.19", "Elm 0.19"); elmVersion.setEnum(supportedVersions); cliOptions.add(elmVersion); + final CliOption elmPrefixCustomTypeVariants = CliOption.newBoolean(ELM_PREFIX_CUSTOM_TYPE_VARIANTS, "Prefix custom type variants"); + cliOptions.add(elmPrefixCustomTypeVariants); } @Override public void processOpts() { super.processOpts(); - if (additionalProperties.containsKey(ELM_VERSION)) { final String version = (String) additionalProperties.get(ELM_VERSION); if ("0.18".equals(version)) { @@ -178,6 +181,10 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { } } + if (additionalProperties.containsKey(ELM_PREFIX_CUSTOM_TYPE_VARIANTS)) { + elmPrefixCustomTypeVariants = Boolean.TRUE.equals(Boolean.valueOf(additionalProperties.get(ELM_PREFIX_CUSTOM_TYPE_VARIANTS).toString())); + } + if (StringUtils.isEmpty(System.getenv("ELM_POST_PROCESS_FILE"))) { if (elmVersion.equals(ElmVersion.ELM_018)) { // 0.18 LOGGER.info("Environment variable ELM_POST_PROCESS_FILE not defined so the Elm code may not be properly formatted. To define it, try `export ELM_POST_PROCESS_FILE=\"/usr/local/bin/elm-format --elm-version={} --yes\"` (Linux/Mac)", "0.18"); @@ -188,7 +195,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { switch (elmVersion) { case ELM_018: - LOGGER.info("Elm version = 0.18"); + LOGGER.info("Elm version: 0.18"); additionalProperties.put("isElm018", true); supportingFiles.add(new SupportingFile("DateOnly018.mustache", "src", "DateOnly.elm")); supportingFiles.add(new SupportingFile("DateTime018.mustache", "src", "DateTime.elm")); @@ -196,7 +203,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("Main018.mustache", "src", "Main.elm")); break; case ELM_019: - LOGGER.info("Elm version = 0.19"); + LOGGER.info("Elm version: 0.19"); additionalProperties.put("isElm019", true); supportingFiles.add(new SupportingFile("DateOnly.mustache", "src", "DateOnly.elm")); supportingFiles.add(new SupportingFile("DateTime.mustache", "src", "DateTime.elm")); @@ -590,6 +597,28 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { addEncoderAndDecoder(parameter.vendorExtensions, parameter.dataType, isPrimitiveType ? DataTypeExposure.PRIMITIVE : DataTypeExposure.EXTERNAL); } + @Override + public void updateCodegenPropertyEnum(final CodegenProperty property) { + super.updateCodegenPropertyEnum(property); + if (!elmPrefixCustomTypeVariants) { + return; + } + + final Map allowableValues = property.allowableValues; + if (allowableValues == null) { + return; + } + + final List> enumVars = (ArrayList>) allowableValues.get("enumVars"); + if (enumVars == null) { + return; + } + final String prefix = toEnumName(property); + for (Map enumVar : enumVars) { + enumVar.put("name", prefix + enumVar.get("name")); + } + } + private boolean isPrimitiveDataType(String dataType) { return languageSpecificPrimitives.contains(dataType); } From 3b53ac435fa3b5838b22dfac2d1abe152e8e045f Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 26 Oct 2018 18:28:37 +0800 Subject: [PATCH 34/35] fix duplicate call in JS (#1270) --- .../Javascript/partial_model_generic.mustache | 52 +++++++++++++++---- .../javascript-es6/.openapi-generator/VERSION | 2 +- .../petstore/javascript-es6/docs/FakeApi.md | 2 +- .../petstore/javascript-es6/docs/MapTest.md | 2 +- .../petstore/javascript-es6/docs/PetApi.md | 2 +- .../javascript-es6/src/model/MapTest.js | 5 +- .../.openapi-generator/VERSION | 2 +- .../javascript-promise-es6/docs/FakeApi.md | 2 +- .../javascript-promise-es6/docs/MapTest.md | 2 +- .../javascript-promise-es6/docs/PetApi.md | 2 +- .../src/model/MapTest.js | 5 +- .../.openapi-generator/VERSION | 2 +- .../javascript-promise/docs/FakeApi.md | 2 +- .../javascript-promise/docs/MapTest.md | 2 +- .../javascript-promise/docs/PetApi.md | 2 +- .../javascript-promise/src/ApiClient.js | 2 +- .../src/api/AnotherFakeApi.js | 2 +- .../javascript-promise/src/api/FakeApi.js | 2 +- .../src/api/FakeClassnameTags123Api.js | 2 +- .../javascript-promise/src/api/PetApi.js | 2 +- .../javascript-promise/src/api/StoreApi.js | 2 +- .../javascript-promise/src/api/UserApi.js | 2 +- .../petstore/javascript-promise/src/index.js | 2 +- .../src/model/AdditionalPropertiesClass.js | 6 +-- .../javascript-promise/src/model/Animal.js | 5 +- .../src/model/AnimalFarm.js | 4 +- .../src/model/ApiResponse.js | 7 +-- .../src/model/ArrayOfArrayOfNumberOnly.js | 5 +- .../src/model/ArrayOfNumberOnly.js | 5 +- .../javascript-promise/src/model/ArrayTest.js | 7 +-- .../src/model/Capitalization.js | 10 +--- .../javascript-promise/src/model/Cat.js | 7 +-- .../javascript-promise/src/model/Category.js | 6 +-- .../src/model/ClassModel.js | 5 +- .../javascript-promise/src/model/Client.js | 5 +- .../javascript-promise/src/model/Dog.js | 7 +-- .../src/model/EnumArrays.js | 6 +-- .../javascript-promise/src/model/EnumClass.js | 2 +- .../javascript-promise/src/model/EnumTest.js | 8 +-- .../javascript-promise/src/model/File.js | 5 +- .../src/model/FileSchemaTestClass.js | 6 +-- .../src/model/FormatTest.js | 13 +---- .../src/model/HasOnlyReadOnly.js | 6 +-- .../javascript-promise/src/model/List.js | 5 +- .../javascript-promise/src/model/MapTest.js | 20 +++---- ...dPropertiesAndAdditionalPropertiesClass.js | 7 +-- .../src/model/Model200Response.js | 6 +-- .../src/model/ModelReturn.js | 5 +- .../javascript-promise/src/model/Name.js | 7 +-- .../src/model/NumberOnly.js | 5 +- .../javascript-promise/src/model/Order.js | 10 +--- .../src/model/OuterComposite.js | 7 +-- .../javascript-promise/src/model/OuterEnum.js | 2 +- .../javascript-promise/src/model/Pet.js | 8 +-- .../src/model/ReadOnlyFirst.js | 6 +-- .../src/model/SpecialModelName.js | 5 +- .../src/model/StringBooleanMap.js | 4 +- .../javascript-promise/src/model/Tag.js | 6 +-- .../javascript-promise/src/model/User.js | 12 +---- .../javascript/.openapi-generator/VERSION | 2 +- .../petstore/javascript/docs/FakeApi.md | 2 +- .../petstore/javascript/docs/MapTest.md | 2 +- .../client/petstore/javascript/docs/PetApi.md | 2 +- .../petstore/javascript/src/ApiClient.js | 2 +- .../javascript/src/api/AnotherFakeApi.js | 2 +- .../petstore/javascript/src/api/FakeApi.js | 2 +- .../src/api/FakeClassnameTags123Api.js | 2 +- .../petstore/javascript/src/api/PetApi.js | 2 +- .../petstore/javascript/src/api/StoreApi.js | 2 +- .../petstore/javascript/src/api/UserApi.js | 2 +- .../client/petstore/javascript/src/index.js | 2 +- .../src/model/AdditionalPropertiesClass.js | 6 +-- .../petstore/javascript/src/model/Animal.js | 5 +- .../javascript/src/model/AnimalFarm.js | 4 +- .../javascript/src/model/ApiResponse.js | 7 +-- .../src/model/ArrayOfArrayOfNumberOnly.js | 5 +- .../javascript/src/model/ArrayOfNumberOnly.js | 5 +- .../javascript/src/model/ArrayTest.js | 7 +-- .../javascript/src/model/Capitalization.js | 10 +--- .../petstore/javascript/src/model/Cat.js | 7 +-- .../petstore/javascript/src/model/Category.js | 6 +-- .../javascript/src/model/ClassModel.js | 5 +- .../petstore/javascript/src/model/Client.js | 5 +- .../petstore/javascript/src/model/Dog.js | 7 +-- .../javascript/src/model/EnumArrays.js | 6 +-- .../javascript/src/model/EnumClass.js | 2 +- .../petstore/javascript/src/model/EnumTest.js | 8 +-- .../petstore/javascript/src/model/File.js | 5 +- .../src/model/FileSchemaTestClass.js | 6 +-- .../javascript/src/model/FormatTest.js | 13 +---- .../javascript/src/model/HasOnlyReadOnly.js | 6 +-- .../petstore/javascript/src/model/List.js | 5 +- .../petstore/javascript/src/model/MapTest.js | 20 +++---- ...dPropertiesAndAdditionalPropertiesClass.js | 7 +-- .../javascript/src/model/Model200Response.js | 6 +-- .../javascript/src/model/ModelReturn.js | 5 +- .../petstore/javascript/src/model/Name.js | 7 +-- .../javascript/src/model/NumberOnly.js | 5 +- .../petstore/javascript/src/model/Order.js | 10 +--- .../javascript/src/model/OuterComposite.js | 7 +-- .../javascript/src/model/OuterEnum.js | 2 +- .../petstore/javascript/src/model/Pet.js | 8 +-- .../javascript/src/model/ReadOnlyFirst.js | 6 +-- .../javascript/src/model/SpecialModelName.js | 5 +- .../javascript/src/model/StringBooleanMap.js | 4 +- .../petstore/javascript/src/model/Tag.js | 6 +-- .../petstore/javascript/src/model/User.js | 12 +---- 107 files changed, 165 insertions(+), 441 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Javascript/partial_model_generic.mustache b/modules/openapi-generator/src/main/resources/Javascript/partial_model_generic.mustache index 74d410ddec8..cc6dab688c4 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/partial_model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/partial_model_generic.mustache @@ -1,4 +1,3 @@ - {{#models}}{{#model}} {{#emitJSDoc}} /** @@ -21,11 +20,28 @@ var _this = this; {{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array(); Object.setPrototypeOf(_this, exports); -{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}} -{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}}); -{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}} -{{/vars}}{{#parent}}{{^parentModel}} return _this; -{{/parentModel}}{{/parent}} }; +{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}} + {{#useInheritance}} + {{#parentModel}} + {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}}); + {{/parentModel}} + {{^parentModel}} + {{#interfaceModels}} + {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}}); + {{/interfaceModels}} + {{/parentModel}} + {{/useInheritance}} + {{#vars}} + {{#required}} + _this['{{baseName}}'] = {{name}}; + {{/required}} + {{/vars}} + {{#parent}} + {{^parentModel}} + return _this; + {{/parentModel}} + {{/parent}} + }; {{#emitJSDoc}} /** @@ -45,13 +61,27 @@ exports.constructFromObject = function(data, obj) { if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { obj = obj || new exports(); -{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}'); -{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}} -{{#interfaces}} {{.}}.constructFromObject(data, obj); -{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) { + {{#parent}} + {{^parentModel}} + ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}'); + {{/parentModel}} + {{/parent}} + {{#useInheritance}} + {{#parentModel}} + {{classname}}.constructFromObject(data, obj); + {{/parentModel}} + {{^parentModel}} + {{#interfaces}} + {{.}}.constructFromObject(data, obj); + {{/interfaces}} + {{/parentModel}} + {{/useInheritance}} + {{#vars}} + if (data.hasOwnProperty('{{baseName}}')) { obj['{{baseName}}']{{{defaultValueWithParam}}} } -{{/vars}} } + {{/vars}} + } return obj; } {{/vendorExtensions.x-isPrimitive}} diff --git a/samples/client/petstore/javascript-es6/.openapi-generator/VERSION b/samples/client/petstore/javascript-es6/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/javascript-es6/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-es6/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-es6/docs/FakeApi.md b/samples/client/petstore/javascript-es6/docs/FakeApi.md index b51de14ceaa..0407a450fff 100644 --- a/samples/client/petstore/javascript-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-es6/docs/FakeApi.md @@ -464,7 +464,7 @@ test inline additionalProperties import OpenApiPetstore from 'open_api_petstore'; let apiInstance = new OpenApiPetstore.FakeApi(); -let requestBody = {key: "inner_example"}; // {String: String} | request body +let requestBody = {key: "null"}; // {String: String} | request body apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response) => { if (error) { console.error(error); diff --git a/samples/client/petstore/javascript-es6/docs/MapTest.md b/samples/client/petstore/javascript-es6/docs/MapTest.md index f1075bf0681..152d3fbe8c7 100644 --- a/samples/client/petstore/javascript-es6/docs/MapTest.md +++ b/samples/client/petstore/javascript-es6/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **mapMapOfString** | **{String: {String: String}}** | | [optional] **mapOfEnumString** | **{String: String}** | | [optional] **directMap** | **{String: Boolean}** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **{String: Boolean}** | | [optional] diff --git a/samples/client/petstore/javascript-es6/docs/PetApi.md b/samples/client/petstore/javascript-es6/docs/PetApi.md index 76dabe26aed..a9457f7ca5c 100644 --- a/samples/client/petstore/javascript-es6/docs/PetApi.md +++ b/samples/client/petstore/javascript-es6/docs/PetApi.md @@ -174,7 +174,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new OpenApiPetstore.PetApi(); -let tags = ["inner_example"]; // [String] | Tags to filter by +let tags = ["null"]; // [String] | Tags to filter by apiInstance.findPetsByTags(tags, (error, data, response) => { if (error) { console.error(error); diff --git a/samples/client/petstore/javascript-es6/src/model/MapTest.js b/samples/client/petstore/javascript-es6/src/model/MapTest.js index 31c37d601ce..683ca05ebc2 100644 --- a/samples/client/petstore/javascript-es6/src/model/MapTest.js +++ b/samples/client/petstore/javascript-es6/src/model/MapTest.js @@ -12,7 +12,6 @@ */ import ApiClient from '../ApiClient'; -import StringBooleanMap from './StringBooleanMap'; /** * The MapTest model module. @@ -58,7 +57,7 @@ class MapTest { obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'}); } if (data.hasOwnProperty('indirect_map')) { - obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']); + obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'}); } } return obj; @@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined; MapTest.prototype['direct_map'] = undefined; /** - * @member {module:model/StringBooleanMap} indirect_map + * @member {Object.} indirect_map */ MapTest.prototype['indirect_map'] = undefined; diff --git a/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION b/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md index bb62b487674..a9e7e06545d 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md @@ -455,7 +455,7 @@ test inline additionalProperties import OpenApiPetstore from 'open_api_petstore'; let apiInstance = new OpenApiPetstore.FakeApi(); -let requestBody = {key: "inner_example"}; // {String: String} | request body +let requestBody = {key: "null"}; // {String: String} | request body apiInstance.testInlineAdditionalProperties(requestBody).then(() => { console.log('API called successfully.'); }, (error) => { diff --git a/samples/client/petstore/javascript-promise-es6/docs/MapTest.md b/samples/client/petstore/javascript-promise-es6/docs/MapTest.md index f1075bf0681..152d3fbe8c7 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/MapTest.md +++ b/samples/client/petstore/javascript-promise-es6/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **mapMapOfString** | **{String: {String: String}}** | | [optional] **mapOfEnumString** | **{String: String}** | | [optional] **directMap** | **{String: Boolean}** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **{String: Boolean}** | | [optional] diff --git a/samples/client/petstore/javascript-promise-es6/docs/PetApi.md b/samples/client/petstore/javascript-promise-es6/docs/PetApi.md index 1978431440f..d80f41b2c8e 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/PetApi.md @@ -171,7 +171,7 @@ let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new OpenApiPetstore.PetApi(); -let tags = ["inner_example"]; // [String] | Tags to filter by +let tags = ["null"]; // [String] | Tags to filter by apiInstance.findPetsByTags(tags).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { diff --git a/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js b/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js index 31c37d601ce..683ca05ebc2 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js @@ -12,7 +12,6 @@ */ import ApiClient from '../ApiClient'; -import StringBooleanMap from './StringBooleanMap'; /** * The MapTest model module. @@ -58,7 +57,7 @@ class MapTest { obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'}); } if (data.hasOwnProperty('indirect_map')) { - obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']); + obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'}); } } return obj; @@ -83,7 +82,7 @@ MapTest.prototype['map_of_enum_string'] = undefined; MapTest.prototype['direct_map'] = undefined; /** - * @member {module:model/StringBooleanMap} indirect_map + * @member {Object.} indirect_map */ MapTest.prototype['indirect_map'] = undefined; diff --git a/samples/client/petstore/javascript-promise/.openapi-generator/VERSION b/samples/client/petstore/javascript-promise/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/javascript-promise/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-promise/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-promise/docs/FakeApi.md b/samples/client/petstore/javascript-promise/docs/FakeApi.md index cb50ee6de64..d582de17b0a 100644 --- a/samples/client/petstore/javascript-promise/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise/docs/FakeApi.md @@ -455,7 +455,7 @@ test inline additionalProperties var OpenApiPetstore = require('open_api_petstore'); var apiInstance = new OpenApiPetstore.FakeApi(); -var requestBody = {key: "inner_example"}; // {String: String} | request body +var requestBody = {key: "null"}; // {String: String} | request body apiInstance.testInlineAdditionalProperties(requestBody).then(function() { console.log('API called successfully.'); }, function(error) { diff --git a/samples/client/petstore/javascript-promise/docs/MapTest.md b/samples/client/petstore/javascript-promise/docs/MapTest.md index f1075bf0681..152d3fbe8c7 100644 --- a/samples/client/petstore/javascript-promise/docs/MapTest.md +++ b/samples/client/petstore/javascript-promise/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **mapMapOfString** | **{String: {String: String}}** | | [optional] **mapOfEnumString** | **{String: String}** | | [optional] **directMap** | **{String: Boolean}** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **{String: Boolean}** | | [optional] diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 30f008958ff..99a95f64a38 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -167,7 +167,7 @@ var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new OpenApiPetstore.PetApi(); -var tags = ["inner_example"]; // [String] | Tags to filter by +var tags = ["null"]; // [String] | Tags to filter by apiInstance.findPetsByTags(tags).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index dd286d4987c..fd9b273f1c4 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js b/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js index d744580ecdd..4eda5bcca47 100644 --- a/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js index a26b09ce175..9ce1caaeae7 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js b/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js index b626387882b..a7afa739af3 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 68519c5a1d5..f1ec4381556 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index d00779af1a2..c84d1e93c7f 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 82f0c1a06a6..88e15f0386d 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index 1eebdbf5ff3..f7de11f4e55 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js index e41dca8e660..aa85406e6a6 100644 --- a/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The AdditionalPropertiesClass model module. * @module model/AdditionalPropertiesClass @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('map_property')) { obj['map_property'] = ApiClient.convertToType(data['map_property'], {'String': 'String'}); } diff --git a/samples/client/petstore/javascript-promise/src/model/Animal.js b/samples/client/petstore/javascript-promise/src/model/Animal.js index 43aaacc12b5..1c26f336515 100644 --- a/samples/client/petstore/javascript-promise/src/model/Animal.js +++ b/samples/client/petstore/javascript-promise/src/model/Animal.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Animal model module. * @module model/Animal @@ -49,7 +48,6 @@ var _this = this; _this['className'] = className; - }; /** @@ -62,7 +60,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('className')) { obj['className'] = ApiClient.convertToType(data['className'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js index f3d2c132d12..1186bb4b207 100644 --- a/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The AnimalFarm model module. * @module model/AnimalFarm @@ -64,7 +63,6 @@ if (data) { obj = obj || new exports(); ApiClient.constructFromObject(data, obj, 'Animal'); - } return obj; } diff --git a/samples/client/petstore/javascript-promise/src/model/ApiResponse.js b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js index 2d33b0b7a23..8a5161ed12d 100644 --- a/samples/client/petstore/javascript-promise/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ApiResponse model module. * @module model/ApiResponse @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('code')) { obj['code'] = ApiClient.convertToType(data['code'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js index 41463b0e371..aa150c35acc 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayOfArrayOfNumberOnly model module. * @module model/ArrayOfArrayOfNumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('ArrayArrayNumber')) { obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); } diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js index f3b0ac217e1..c0a345a76b1 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayOfNumberOnly model module. * @module model/ArrayOfNumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('ArrayNumber')) { obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); } diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayTest.js b/samples/client/petstore/javascript-promise/src/model/ArrayTest.js index 6b8aeade8b0..955463cf2ce 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayTest model module. * @module model/ArrayTest @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('array_of_string')) { obj['array_of_string'] = ApiClient.convertToType(data['array_of_string'], ['String']); } diff --git a/samples/client/petstore/javascript-promise/src/model/Capitalization.js b/samples/client/petstore/javascript-promise/src/model/Capitalization.js index 67c027686a9..2f960c5b9ef 100644 --- a/samples/client/petstore/javascript-promise/src/model/Capitalization.js +++ b/samples/client/petstore/javascript-promise/src/model/Capitalization.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Capitalization model module. * @module model/Capitalization @@ -47,12 +46,6 @@ var exports = function() { var _this = this; - - - - - - }; /** @@ -65,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('smallCamel')) { obj['smallCamel'] = ApiClient.convertToType(data['smallCamel'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Cat.js b/samples/client/petstore/javascript-promise/src/model/Cat.js index 6f8ca2e91fd..20131cfe2d1 100644 --- a/samples/client/petstore/javascript-promise/src/model/Cat.js +++ b/samples/client/petstore/javascript-promise/src/model/Cat.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Cat model module. * @module model/Cat @@ -49,9 +48,8 @@ */ var exports = function(className) { var _this = this; - Animal.call(_this, className); - Animal.call(_this, className); + Animal.call(_this, className); }; /** @@ -65,7 +63,6 @@ if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); - Animal.constructFromObject(data, obj); if (data.hasOwnProperty('declawed')) { obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index ba82e88bd49..bd9d7e54685 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Category model module. * @module model/Category @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/ClassModel.js b/samples/client/petstore/javascript-promise/src/model/ClassModel.js index 6592fdeebc9..a1208fdd575 100644 --- a/samples/client/petstore/javascript-promise/src/model/ClassModel.js +++ b/samples/client/petstore/javascript-promise/src/model/ClassModel.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ClassModel model module. * @module model/ClassModel @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('_class')) { obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Client.js b/samples/client/petstore/javascript-promise/src/model/Client.js index 00fe25ca2d7..e2af3bfa10f 100644 --- a/samples/client/petstore/javascript-promise/src/model/Client.js +++ b/samples/client/petstore/javascript-promise/src/model/Client.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Client model module. * @module model/Client @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('client')) { obj['client'] = ApiClient.convertToType(data['client'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Dog.js b/samples/client/petstore/javascript-promise/src/model/Dog.js index 7a74ef477b4..f5a73c3bca8 100644 --- a/samples/client/petstore/javascript-promise/src/model/Dog.js +++ b/samples/client/petstore/javascript-promise/src/model/Dog.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Dog model module. * @module model/Dog @@ -49,9 +48,8 @@ */ var exports = function(className) { var _this = this; - Animal.call(_this, className); - Animal.call(_this, className); + Animal.call(_this, className); }; /** @@ -65,7 +63,6 @@ if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); - Animal.constructFromObject(data, obj); if (data.hasOwnProperty('breed')) { obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/EnumArrays.js b/samples/client/petstore/javascript-promise/src/model/EnumArrays.js index 7bbb3af35d2..c0c93dfecb7 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumArrays.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The EnumArrays model module. * @module model/EnumArrays @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('just_symbol')) { obj['just_symbol'] = ApiClient.convertToType(data['just_symbol'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/EnumClass.js b/samples/client/petstore/javascript-promise/src/model/EnumClass.js index 3a8a7f52d94..be0e548d3ff 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/EnumTest.js b/samples/client/petstore/javascript-promise/src/model/EnumTest.js index 25d166c5c8a..b0c37e129bc 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumTest.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The EnumTest model module. * @module model/EnumTest @@ -48,11 +47,7 @@ var exports = function(enumStringRequired) { var _this = this; - _this['enum_string_required'] = enumStringRequired; - - - }; /** @@ -65,7 +60,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('enum_string')) { obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/File.js b/samples/client/petstore/javascript-promise/src/model/File.js index 706f20eff08..eb5bd17d80b 100644 --- a/samples/client/petstore/javascript-promise/src/model/File.js +++ b/samples/client/petstore/javascript-promise/src/model/File.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The File model module. * @module model/File @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('sourceURI')) { obj['sourceURI'] = ApiClient.convertToType(data['sourceURI'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js b/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js index 2bc85b700b0..93a23dcbd7b 100644 --- a/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js +++ b/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The FileSchemaTestClass model module. * @module model/FileSchemaTestClass @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('file')) { obj['file'] = File.constructFromObject(data['file']); } diff --git a/samples/client/petstore/javascript-promise/src/model/FormatTest.js b/samples/client/petstore/javascript-promise/src/model/FormatTest.js index 679e769b5b2..63b9b283299 100644 --- a/samples/client/petstore/javascript-promise/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-promise/src/model/FormatTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The FormatTest model module. * @module model/FormatTest @@ -51,18 +50,9 @@ var exports = function(_number, _byte, _date, password) { var _this = this; - - - _this['number'] = _number; - - - _this['byte'] = _byte; - _this['date'] = _date; - - _this['password'] = password; }; @@ -76,7 +66,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('integer')) { obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js index 6b42db4416e..817af5d86b7 100644 --- a/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The HasOnlyReadOnly model module. * @module model/HasOnlyReadOnly @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('bar')) { obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/List.js b/samples/client/petstore/javascript-promise/src/model/List.js index 05c95f2613a..4412a32c822 100644 --- a/samples/client/petstore/javascript-promise/src/model/List.js +++ b/samples/client/petstore/javascript-promise/src/model/List.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The List model module. * @module model/List @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('123-list')) { obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/MapTest.js b/samples/client/petstore/javascript-promise/src/model/MapTest.js index 65b317db8b5..f5499f47517 100644 --- a/samples/client/petstore/javascript-promise/src/model/MapTest.js +++ b/samples/client/petstore/javascript-promise/src/model/MapTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -16,23 +16,22 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/StringBooleanMap'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./StringBooleanMap')); + module.exports = factory(require('../ApiClient')); } else { // Browser globals (root is window) if (!root.OpenApiPetstore) { root.OpenApiPetstore = {}; } - root.OpenApiPetstore.MapTest = factory(root.OpenApiPetstore.ApiClient, root.OpenApiPetstore.StringBooleanMap); + root.OpenApiPetstore.MapTest = factory(root.OpenApiPetstore.ApiClient); } -}(this, function(ApiClient, StringBooleanMap) { +}(this, function(ApiClient) { 'use strict'; - /** * The MapTest model module. * @module model/MapTest @@ -47,10 +46,6 @@ var exports = function() { var _this = this; - - - - }; /** @@ -63,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('map_map_of_string')) { obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); } @@ -74,7 +68,7 @@ obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'}); } if (data.hasOwnProperty('indirect_map')) { - obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']); + obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'}); } } return obj; @@ -93,7 +87,7 @@ */ exports.prototype['direct_map'] = undefined; /** - * @member {module:model/StringBooleanMap} indirect_map + * @member {Object.} indirect_map */ exports.prototype['indirect_map'] = undefined; diff --git a/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index 9291b7ba8a4..e92184fcf2d 100644 --- a/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The MixedPropertiesAndAdditionalPropertiesClass model module. * @module model/MixedPropertiesAndAdditionalPropertiesClass @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('uuid')) { obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Model200Response.js b/samples/client/petstore/javascript-promise/src/model/Model200Response.js index 82d0b362160..45ecd7bcbc3 100644 --- a/samples/client/petstore/javascript-promise/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-promise/src/model/Model200Response.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Model200Response model module. * @module model/Model200Response @@ -48,8 +47,6 @@ var exports = function() { var _this = this; - - }; /** @@ -62,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js index b4ca8a7875d..ba50a193fca 100644 --- a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ModelReturn model module. * @module model/ModelReturn @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('return')) { obj['return'] = ApiClient.convertToType(data['return'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js index a18ddecd8d9..77fe28677aa 100644 --- a/samples/client/petstore/javascript-promise/src/model/Name.js +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Name model module. * @module model/Name @@ -50,9 +49,6 @@ var _this = this; _this['name'] = name; - - - }; /** @@ -65,7 +61,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/NumberOnly.js b/samples/client/petstore/javascript-promise/src/model/NumberOnly.js index f25c7bbc8b2..dd082b35f36 100644 --- a/samples/client/petstore/javascript-promise/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/NumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The NumberOnly model module. * @module model/NumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('JustNumber')) { obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index a65a0024885..6e5659cfce0 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Order model module. * @module model/Order @@ -47,12 +46,6 @@ var exports = function() { var _this = this; - - - - - - }; /** @@ -65,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/OuterComposite.js b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js index e9c23b1e619..3660cda183d 100644 --- a/samples/client/petstore/javascript-promise/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The OuterComposite model module. * @module model/OuterComposite @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('my_number')) { obj['my_number'] = ApiClient.convertToType(data['my_number'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/OuterEnum.js b/samples/client/petstore/javascript-promise/src/model/OuterEnum.js index bca0fdf08ce..77242917208 100644 --- a/samples/client/petstore/javascript-promise/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript-promise/src/model/OuterEnum.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index a4edb988958..422bab25fd1 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Pet model module. * @module model/Pet @@ -49,12 +48,8 @@ var exports = function(name, photoUrls) { var _this = this; - - _this['name'] = name; _this['photoUrls'] = photoUrls; - - }; /** @@ -67,7 +62,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js index f05c53ebab3..2c0cb780282 100644 --- a/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ReadOnlyFirst model module. * @module model/ReadOnlyFirst @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('bar')) { obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); } diff --git a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js index 3de755a7986..b694729ee2a 100644 --- a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The SpecialModelName model module. * @module model/SpecialModelName @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('$special[property.name]')) { obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js b/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js index 8a82f9d99ba..aa287f6cdc9 100644 --- a/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js +++ b/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The StringBooleanMap model module. * @module model/StringBooleanMap @@ -62,7 +61,6 @@ if (data) { obj = obj || new exports(); ApiClient.constructFromObject(data, obj, 'Boolean'); - } return obj; } diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index c57bfb9ca07..3ba4159ebb6 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Tag model module. * @module model/Tag @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index 6f2f6910f4d..8c500d4ae3c 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The User model module. * @module model/User @@ -47,14 +46,6 @@ var exports = function() { var _this = this; - - - - - - - - }; /** @@ -67,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript/.openapi-generator/VERSION b/samples/client/petstore/javascript/.openapi-generator/VERSION index 6d94c9c2e12..a6527129083 100644 --- a/samples/client/petstore/javascript/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +3.3.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript/docs/FakeApi.md b/samples/client/petstore/javascript/docs/FakeApi.md index 73f3740d199..c7d9c6de6c7 100644 --- a/samples/client/petstore/javascript/docs/FakeApi.md +++ b/samples/client/petstore/javascript/docs/FakeApi.md @@ -473,7 +473,7 @@ test inline additionalProperties var OpenApiPetstore = require('open_api_petstore'); var apiInstance = new OpenApiPetstore.FakeApi(); -var requestBody = {key: "inner_example"}; // {String: String} | request body +var requestBody = {key: "null"}; // {String: String} | request body var callback = function(error, data, response) { if (error) { console.error(error); diff --git a/samples/client/petstore/javascript/docs/MapTest.md b/samples/client/petstore/javascript/docs/MapTest.md index f1075bf0681..152d3fbe8c7 100644 --- a/samples/client/petstore/javascript/docs/MapTest.md +++ b/samples/client/petstore/javascript/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **mapMapOfString** | **{String: {String: String}}** | | [optional] **mapOfEnumString** | **{String: String}** | | [optional] **directMap** | **{String: Boolean}** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **{String: Boolean}** | | [optional] diff --git a/samples/client/petstore/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index 265fc5a9b25..3bd45fe4f7a 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/docs/PetApi.md @@ -173,7 +173,7 @@ var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new OpenApiPetstore.PetApi(); -var tags = ["inner_example"]; // [String] | Tags to filter by +var tags = ["null"]; // [String] | Tags to filter by var callback = function(error, data, response) { if (error) { console.error(error); diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 2e1ad976bf7..e5d21515ca0 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/AnotherFakeApi.js b/samples/client/petstore/javascript/src/api/AnotherFakeApi.js index 4761e83415d..3b2af03572a 100644 --- a/samples/client/petstore/javascript/src/api/AnotherFakeApi.js +++ b/samples/client/petstore/javascript/src/api/AnotherFakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js index 3f19f090267..9f3e8d2ebe2 100644 --- a/samples/client/petstore/javascript/src/api/FakeApi.js +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js b/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js index 1fda0fa1451..ca878d474b1 100644 --- a/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js +++ b/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 36243ed29e1..834ab1f71aa 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 32ce6e83cfc..658de0dd20b 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 13c24345f72..f5daf5012d2 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 1eebdbf5ff3..f7de11f4e55 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js index e41dca8e660..aa85406e6a6 100644 --- a/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The AdditionalPropertiesClass model module. * @module model/AdditionalPropertiesClass @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('map_property')) { obj['map_property'] = ApiClient.convertToType(data['map_property'], {'String': 'String'}); } diff --git a/samples/client/petstore/javascript/src/model/Animal.js b/samples/client/petstore/javascript/src/model/Animal.js index 43aaacc12b5..1c26f336515 100644 --- a/samples/client/petstore/javascript/src/model/Animal.js +++ b/samples/client/petstore/javascript/src/model/Animal.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Animal model module. * @module model/Animal @@ -49,7 +48,6 @@ var _this = this; _this['className'] = className; - }; /** @@ -62,7 +60,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('className')) { obj['className'] = ApiClient.convertToType(data['className'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/AnimalFarm.js b/samples/client/petstore/javascript/src/model/AnimalFarm.js index f3d2c132d12..1186bb4b207 100644 --- a/samples/client/petstore/javascript/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript/src/model/AnimalFarm.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The AnimalFarm model module. * @module model/AnimalFarm @@ -64,7 +63,6 @@ if (data) { obj = obj || new exports(); ApiClient.constructFromObject(data, obj, 'Animal'); - } return obj; } diff --git a/samples/client/petstore/javascript/src/model/ApiResponse.js b/samples/client/petstore/javascript/src/model/ApiResponse.js index 2d33b0b7a23..8a5161ed12d 100644 --- a/samples/client/petstore/javascript/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript/src/model/ApiResponse.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ApiResponse model module. * @module model/ApiResponse @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('code')) { obj['code'] = ApiClient.convertToType(data['code'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js index 41463b0e371..aa150c35acc 100644 --- a/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayOfArrayOfNumberOnly model module. * @module model/ArrayOfArrayOfNumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('ArrayArrayNumber')) { obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); } diff --git a/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js index f3b0ac217e1..c0a345a76b1 100644 --- a/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayOfNumberOnly model module. * @module model/ArrayOfNumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('ArrayNumber')) { obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); } diff --git a/samples/client/petstore/javascript/src/model/ArrayTest.js b/samples/client/petstore/javascript/src/model/ArrayTest.js index 6b8aeade8b0..955463cf2ce 100644 --- a/samples/client/petstore/javascript/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript/src/model/ArrayTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ArrayTest model module. * @module model/ArrayTest @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('array_of_string')) { obj['array_of_string'] = ApiClient.convertToType(data['array_of_string'], ['String']); } diff --git a/samples/client/petstore/javascript/src/model/Capitalization.js b/samples/client/petstore/javascript/src/model/Capitalization.js index 67c027686a9..2f960c5b9ef 100644 --- a/samples/client/petstore/javascript/src/model/Capitalization.js +++ b/samples/client/petstore/javascript/src/model/Capitalization.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Capitalization model module. * @module model/Capitalization @@ -47,12 +46,6 @@ var exports = function() { var _this = this; - - - - - - }; /** @@ -65,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('smallCamel')) { obj['smallCamel'] = ApiClient.convertToType(data['smallCamel'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/Cat.js b/samples/client/petstore/javascript/src/model/Cat.js index 6f8ca2e91fd..20131cfe2d1 100644 --- a/samples/client/petstore/javascript/src/model/Cat.js +++ b/samples/client/petstore/javascript/src/model/Cat.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Cat model module. * @module model/Cat @@ -49,9 +48,8 @@ */ var exports = function(className) { var _this = this; - Animal.call(_this, className); - Animal.call(_this, className); + Animal.call(_this, className); }; /** @@ -65,7 +63,6 @@ if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); - Animal.constructFromObject(data, obj); if (data.hasOwnProperty('declawed')) { obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); } diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index ba82e88bd49..bd9d7e54685 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Category model module. * @module model/Category @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/ClassModel.js b/samples/client/petstore/javascript/src/model/ClassModel.js index 6592fdeebc9..a1208fdd575 100644 --- a/samples/client/petstore/javascript/src/model/ClassModel.js +++ b/samples/client/petstore/javascript/src/model/ClassModel.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ClassModel model module. * @module model/ClassModel @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('_class')) { obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/Client.js b/samples/client/petstore/javascript/src/model/Client.js index 00fe25ca2d7..e2af3bfa10f 100644 --- a/samples/client/petstore/javascript/src/model/Client.js +++ b/samples/client/petstore/javascript/src/model/Client.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Client model module. * @module model/Client @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('client')) { obj['client'] = ApiClient.convertToType(data['client'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/Dog.js b/samples/client/petstore/javascript/src/model/Dog.js index 7a74ef477b4..f5a73c3bca8 100644 --- a/samples/client/petstore/javascript/src/model/Dog.js +++ b/samples/client/petstore/javascript/src/model/Dog.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Dog model module. * @module model/Dog @@ -49,9 +48,8 @@ */ var exports = function(className) { var _this = this; - Animal.call(_this, className); - Animal.call(_this, className); + Animal.call(_this, className); }; /** @@ -65,7 +63,6 @@ if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); - Animal.constructFromObject(data, obj); if (data.hasOwnProperty('breed')) { obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/EnumArrays.js b/samples/client/petstore/javascript/src/model/EnumArrays.js index 7bbb3af35d2..c0c93dfecb7 100644 --- a/samples/client/petstore/javascript/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript/src/model/EnumArrays.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The EnumArrays model module. * @module model/EnumArrays @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('just_symbol')) { obj['just_symbol'] = ApiClient.convertToType(data['just_symbol'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 3a8a7f52d94..be0e548d3ff 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/EnumTest.js b/samples/client/petstore/javascript/src/model/EnumTest.js index 25d166c5c8a..b0c37e129bc 100644 --- a/samples/client/petstore/javascript/src/model/EnumTest.js +++ b/samples/client/petstore/javascript/src/model/EnumTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The EnumTest model module. * @module model/EnumTest @@ -48,11 +47,7 @@ var exports = function(enumStringRequired) { var _this = this; - _this['enum_string_required'] = enumStringRequired; - - - }; /** @@ -65,7 +60,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('enum_string')) { obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/File.js b/samples/client/petstore/javascript/src/model/File.js index 706f20eff08..eb5bd17d80b 100644 --- a/samples/client/petstore/javascript/src/model/File.js +++ b/samples/client/petstore/javascript/src/model/File.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The File model module. * @module model/File @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('sourceURI')) { obj['sourceURI'] = ApiClient.convertToType(data['sourceURI'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js b/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js index 2bc85b700b0..93a23dcbd7b 100644 --- a/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js +++ b/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The FileSchemaTestClass model module. * @module model/FileSchemaTestClass @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('file')) { obj['file'] = File.constructFromObject(data['file']); } diff --git a/samples/client/petstore/javascript/src/model/FormatTest.js b/samples/client/petstore/javascript/src/model/FormatTest.js index 679e769b5b2..63b9b283299 100644 --- a/samples/client/petstore/javascript/src/model/FormatTest.js +++ b/samples/client/petstore/javascript/src/model/FormatTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The FormatTest model module. * @module model/FormatTest @@ -51,18 +50,9 @@ var exports = function(_number, _byte, _date, password) { var _this = this; - - - _this['number'] = _number; - - - _this['byte'] = _byte; - _this['date'] = _date; - - _this['password'] = password; }; @@ -76,7 +66,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('integer')) { obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js index 6b42db4416e..817af5d86b7 100644 --- a/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The HasOnlyReadOnly model module. * @module model/HasOnlyReadOnly @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('bar')) { obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/List.js b/samples/client/petstore/javascript/src/model/List.js index 05c95f2613a..4412a32c822 100644 --- a/samples/client/petstore/javascript/src/model/List.js +++ b/samples/client/petstore/javascript/src/model/List.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The List model module. * @module model/List @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('123-list')) { obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/MapTest.js b/samples/client/petstore/javascript/src/model/MapTest.js index 65b317db8b5..f5499f47517 100644 --- a/samples/client/petstore/javascript/src/model/MapTest.js +++ b/samples/client/petstore/javascript/src/model/MapTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -16,23 +16,22 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/StringBooleanMap'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./StringBooleanMap')); + module.exports = factory(require('../ApiClient')); } else { // Browser globals (root is window) if (!root.OpenApiPetstore) { root.OpenApiPetstore = {}; } - root.OpenApiPetstore.MapTest = factory(root.OpenApiPetstore.ApiClient, root.OpenApiPetstore.StringBooleanMap); + root.OpenApiPetstore.MapTest = factory(root.OpenApiPetstore.ApiClient); } -}(this, function(ApiClient, StringBooleanMap) { +}(this, function(ApiClient) { 'use strict'; - /** * The MapTest model module. * @module model/MapTest @@ -47,10 +46,6 @@ var exports = function() { var _this = this; - - - - }; /** @@ -63,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('map_map_of_string')) { obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); } @@ -74,7 +68,7 @@ obj['direct_map'] = ApiClient.convertToType(data['direct_map'], {'String': 'Boolean'}); } if (data.hasOwnProperty('indirect_map')) { - obj['indirect_map'] = StringBooleanMap.constructFromObject(data['indirect_map']); + obj['indirect_map'] = ApiClient.convertToType(data['indirect_map'], {'String': 'Boolean'}); } } return obj; @@ -93,7 +87,7 @@ */ exports.prototype['direct_map'] = undefined; /** - * @member {module:model/StringBooleanMap} indirect_map + * @member {Object.} indirect_map */ exports.prototype['indirect_map'] = undefined; diff --git a/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index 9291b7ba8a4..e92184fcf2d 100644 --- a/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The MixedPropertiesAndAdditionalPropertiesClass model module. * @module model/MixedPropertiesAndAdditionalPropertiesClass @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('uuid')) { obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js index 82d0b362160..45ecd7bcbc3 100644 --- a/samples/client/petstore/javascript/src/model/Model200Response.js +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Model200Response model module. * @module model/Model200Response @@ -48,8 +47,6 @@ var exports = function() { var _this = this; - - }; /** @@ -62,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/ModelReturn.js b/samples/client/petstore/javascript/src/model/ModelReturn.js index b4ca8a7875d..ba50a193fca 100644 --- a/samples/client/petstore/javascript/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript/src/model/ModelReturn.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ModelReturn model module. * @module model/ModelReturn @@ -48,7 +47,6 @@ var exports = function() { var _this = this; - }; /** @@ -61,7 +59,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('return')) { obj['return'] = ApiClient.convertToType(data['return'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index a18ddecd8d9..77fe28677aa 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Name model module. * @module model/Name @@ -50,9 +49,6 @@ var _this = this; _this['name'] = name; - - - }; /** @@ -65,7 +61,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/NumberOnly.js b/samples/client/petstore/javascript/src/model/NumberOnly.js index f25c7bbc8b2..dd082b35f36 100644 --- a/samples/client/petstore/javascript/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript/src/model/NumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The NumberOnly model module. * @module model/NumberOnly @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('JustNumber')) { obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index a65a0024885..6e5659cfce0 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Order model module. * @module model/Order @@ -47,12 +46,6 @@ var exports = function() { var _this = this; - - - - - - }; /** @@ -65,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/OuterComposite.js b/samples/client/petstore/javascript/src/model/OuterComposite.js index e9c23b1e619..3660cda183d 100644 --- a/samples/client/petstore/javascript/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript/src/model/OuterComposite.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The OuterComposite model module. * @module model/OuterComposite @@ -47,9 +46,6 @@ var exports = function() { var _this = this; - - - }; /** @@ -62,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('my_number')) { obj['my_number'] = ApiClient.convertToType(data['my_number'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/OuterEnum.js b/samples/client/petstore/javascript/src/model/OuterEnum.js index bca0fdf08ce..77242917208 100644 --- a/samples/client/petstore/javascript/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript/src/model/OuterEnum.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index a4edb988958..422bab25fd1 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Pet model module. * @module model/Pet @@ -49,12 +48,8 @@ var exports = function(name, photoUrls) { var _this = this; - - _this['name'] = name; _this['photoUrls'] = photoUrls; - - }; /** @@ -67,7 +62,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js index f05c53ebab3..2c0cb780282 100644 --- a/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The ReadOnlyFirst model module. * @module model/ReadOnlyFirst @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('bar')) { obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); } diff --git a/samples/client/petstore/javascript/src/model/SpecialModelName.js b/samples/client/petstore/javascript/src/model/SpecialModelName.js index 3de755a7986..b694729ee2a 100644 --- a/samples/client/petstore/javascript/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript/src/model/SpecialModelName.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The SpecialModelName model module. * @module model/SpecialModelName @@ -47,7 +46,6 @@ var exports = function() { var _this = this; - }; /** @@ -60,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('$special[property.name]')) { obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/StringBooleanMap.js b/samples/client/petstore/javascript/src/model/StringBooleanMap.js index 8a82f9d99ba..aa287f6cdc9 100644 --- a/samples/client/petstore/javascript/src/model/StringBooleanMap.js +++ b/samples/client/petstore/javascript/src/model/StringBooleanMap.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The StringBooleanMap model module. * @module model/StringBooleanMap @@ -62,7 +61,6 @@ if (data) { obj = obj || new exports(); ApiClient.constructFromObject(data, obj, 'Boolean'); - } return obj; } diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index c57bfb9ca07..3ba4159ebb6 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The Tag model module. * @module model/Tag @@ -47,8 +46,6 @@ var exports = function() { var _this = this; - - }; /** @@ -61,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 6f2f6910f4d..8c500d4ae3c 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.3.0-SNAPSHOT + * OpenAPI Generator version: 3.3.2-SNAPSHOT * * Do not edit the class manually. * @@ -32,7 +32,6 @@ - /** * The User model module. * @module model/User @@ -47,14 +46,6 @@ var exports = function() { var _this = this; - - - - - - - - }; /** @@ -67,7 +58,6 @@ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); - if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } From 6b412607554cef4e3b0d0e56ecc0f8f6edc62b49 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 26 Oct 2018 21:03:17 +0800 Subject: [PATCH 35/35] update documentation --- docs/generators/elm.md | 3 +++ docs/generators/rust.md | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/docs/generators/elm.md b/docs/generators/elm.md index 891a281d1eb..bab23d8acf6 100644 --- a/docs/generators/elm.md +++ b/docs/generators/elm.md @@ -6,4 +6,7 @@ CONFIG OPTIONS for elm 0.19 - Elm 0.19 0.18 - Elm 0.18 + elmPrefixCustomTypeVariants + Prefix custom type variants (Default: false) + Back to the [generators list](README.md) diff --git a/docs/generators/rust.md b/docs/generators/rust.md index c8779939a30..c126505e981 100644 --- a/docs/generators/rust.md +++ b/docs/generators/rust.md @@ -10,4 +10,9 @@ CONFIG OPTIONS for rust hideGenerationTimestamp Hides the generation timestamp when files are generated. (Default: true) + library + library template (sub-template) to use. (Default: hyper) + hyper - HTTP client: Hyper. + reqwest - HTTP client: Reqwest. + Back to the [generators list](README.md)