diff --git a/.github/workflows/gradle-test.yaml b/.github/workflows/gradle-test.yaml new file mode 100644 index 00000000000..192e7de590b --- /dev/null +++ b/.github/workflows/gradle-test.yaml @@ -0,0 +1,56 @@ +name: Gradle tests (Java samples) + +on: + push: + branches: + - master + - '[5-9]+.[0-9]+.x' + - "java*" + paths: + - 'samples/client/petstore/java/**' + pull_request: + branches: + - master + - '[5-9]+.[0-9]+.x' + paths: + - 'samples/openapi3/client/petstore/java/**' +env: + GRADLE_VERSION: 7.2 + +jobs: + build: + name: Gradle tests + runs-on: ubuntu-latest + container: gradle:jdk8 + strategy: + fail-fast: true + matrix: + sample: + - samples/client/petstore/java/jersey2-java8-localdatetime + - samples/client/petstore/java/jersey2-java8 + - samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8 + - samples/openapi3/client/petstore/java/jersey2-java8-special-characters + - samples/openapi3/client/petstore/java/jersey2-java8 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 8 + # Cache Gradle Dependencies + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + # Cache Gradle Wrapper + - name: Setup Gradle Wrapper Cache + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + - name: Build + working-directory: ${{ matrix.sample }} + run: /bin/sh gradlew build -x test diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 642d572ce90..a9f1ef87bb2 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/README.md b/README.md index 9327133b55d..12e6b5efca1 100644 --- a/README.md +++ b/README.md @@ -828,7 +828,10 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2021-07-29 - [How To Rewrite a Huge Codebase](https://dzone.com/articles/how-to-rewrite-a-huge-code-base) by [Curtis Poe](https://dzone.com/users/4565446/publiusovidius.html) - 2021-08-21 - [Generating Client APIs using Swagger Part 1](https://medium.com/@flowsquad/generating-client-apis-using-swagger-part-1-2d46f13f5e92) by [FlowSquad.io](https://medium.com/@flowsquad) - 2021-09-11 - [Invoking AWS ParallelCluster API](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) at [AWS ParallelCluster API official documentation](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) +- 2021-09-20 - [OpenAPI Generator - The Babel Fish of the API World](https://www.youtube.com/watch?v=s2zMtwd5klg) by [Cliffano Subagio (Principal Engineer at Shine Solutions)](https://github.com/cliffano) at [Apidays LIVE Australia 2021](https://www.apidays.global/australia2021/) - 2021-10-02 - [How to Write Fewer Lines of Code with the OpenAPI Generator](https://hackernoon.com/how-to-write-fewer-lines-of-code-with-the-openapi-generator) by [Mikhail Alfa](https://hackernoon.com/u/alphamikle) +- 2021-10-12 - [OpenAPI Generator : 4000 étoiles sur GitHub et des spaghettis](https://www.youtube.com/watch?v=9hEsNBSqTFk) by [Jérémie Bresson](https://github.com/jmini) at [Devoxx FR 2021](https://cfp.devoxx.fr/2021/speaker/jeremie_bresson) +- 2021-10-17 - [Generate a TypeScript HTTP Client From An OpenAPI Spec In DotNET 5](https://richardwillis.info/blog/generate-a-type-script-http-client-from-an-open-api-spec-in-dot-net-5) by [Richard Willis](https://github.com/badsyntax) ## [6 - About Us](#table-of-contents) diff --git a/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml b/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml deleted file mode 100644 index 8582a881d51..00000000000 --- a/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml +++ /dev/null @@ -1,10 +0,0 @@ -generatorName: dart -outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake -inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -templateDir: modules/openapi-generator/src/main/resources/dart2 -typeMappings: - Client: "ModelClient" - File: "ModelFile" -additionalProperties: - hideGenerationTimestamp: "true" - serializationLibrary: json_serializable diff --git a/bin/configs/java-jersey2-8.yaml b/bin/configs/java-jersey2-8.yaml index f968aac6230..ca0452d33e3 100644 --- a/bin/configs/java-jersey2-8.yaml +++ b/bin/configs/java-jersey2-8.yaml @@ -10,3 +10,4 @@ additionalProperties: dateLibrary: java8 useOneOfDiscriminatorLookup: true disallowAdditionalPropertiesIfNotPresent: false + gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all" diff --git a/bin/configs/kotlin-enum-default-value.yaml b/bin/configs/kotlin-enum-default-value.yaml new file mode 100644 index 00000000000..3d8c9f57a8b --- /dev/null +++ b/bin/configs/kotlin-enum-default-value.yaml @@ -0,0 +1,8 @@ +generatorName: kotlin +outputDir: samples/client/petstore/kotlin-enum-default-value +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue10591-enum-defaultValue.yaml +templateDir: modules/openapi-generator/src/main/resources/kotlin-client +additionalProperties: + artifactId: kotlin-enum-default-value + serializableModel: "true" + dateLibrary: java8 diff --git a/bin/configs/spring-cloud-no-nullable.yaml b/bin/configs/spring-cloud-no-nullable.yaml deleted file mode 100644 index 498183c1958..00000000000 --- a/bin/configs/spring-cloud-no-nullable.yaml +++ /dev/null @@ -1,10 +0,0 @@ -generatorName: spring -outputDir: samples/client/petstore/spring-cloud-no-nullable -library: spring-cloud -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/JavaSpring -additionalProperties: - artifactId: petstore-spring-cloud-no-nullable - responseWrapper: HystrixCommand - hideGenerationTimestamp: "true" - openApiNullable: "false" diff --git a/bin/configs/spring-cloud.yaml b/bin/configs/spring-cloud.yaml index 79d97acb1f2..df13fabbf03 100644 --- a/bin/configs/spring-cloud.yaml +++ b/bin/configs/spring-cloud.yaml @@ -1,9 +1,8 @@ generatorName: spring outputDir: samples/client/petstore/spring-cloud library: spring-cloud -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/JavaSpring additionalProperties: artifactId: petstore-spring-cloud - responseWrapper: HystrixCommand hideGenerationTimestamp: "true" diff --git a/docs/generators/dart.md b/docs/generators/dart.md index ef805b78451..cb783be6810 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -19,7 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |pubLibrary|Library name in generated code| |null| |pubName|Name in generated pubspec| |null| |pubVersion|Version in generated pubspec| |null| -|serializationLibrary|Specify serialization library|
**native_serialization**
Use native serializer, backwards compatible
**json_serializable**
Use json_serializable. Experimental and subject to breaking changes without further notice
|native_serialization| +|serializationLibrary|Specify serialization library|
**native_serialization**
Use native serializer, backwards compatible
|native_serialization| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|Source folder for generated code| |null| diff --git a/docs/generators/java.md b/docs/generators/java.md index 21e2817ae3d..5543c075639 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false| +|gradleProperties|Append additional Gradle proeprties to the gradle.properties file| |null| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index b5033cd4fef..5515eaae9bc 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -52,7 +52,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |performBeanValidation|Use Bean Validation Impl. to perform BeanValidation| |false| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |reactive|wrap responses in Mono/Flux Reactor types (spring-boot only)| |false| -|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, HystrixCommand, RxObservable, RxSingle or fully qualified type)| |null| +|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null| |returnSuccessCode|Generated server returns 2xx code| |false| |scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| |scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| diff --git a/docs/integration.md b/docs/integration.md index 29495ebfeb3..e4cc9fa35f6 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -2,7 +2,7 @@ id: integrations title: Workflow Integrations --- -## Workflow Integration (Maven, GitHub, CI/CD) +## Workflow Integration (Gradle, Maven, GitHub, CI/CD) ### Gradle Integration diff --git a/eclipse-formatter.xml b/eclipse-formatter.xml deleted file mode 100644 index a2b5fd1e1f0..00000000000 --- a/eclipse-formatter.xml +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 77d64fdacee..f3a3e13d60e 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -36,6 +36,7 @@ org.apache.maven.plugins maven-jar-plugin + ${maven-jar-plugin.version} @@ -79,14 +80,6 @@ - - net.revelc.code - formatter-maven-plugin - - - ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml - - @@ -152,13 +145,13 @@ org.testng testng - + ${testng.version} test org.mockito mockito-core - ${mockito-version} + ${mockito.version} test diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index 8ce06d6f445..506951cddba 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -32,16 +32,17 @@ com.google.guava guava - ${guava-version} + ${guava.version} org.slf4j slf4j-api - ${slf4j-version} + ${slf4j.version} org.testng testng + ${testng.version} test @@ -70,9 +71,4 @@ - - - 1.7.29 - 26.0-jre - diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java index e1044092007..8bbece6784a 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java @@ -16,8 +16,6 @@ package org.openapitools.codegen.config; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,13 +46,13 @@ public final class GeneratorSettings implements Serializable { private String artifactVersion; private String library; - private final ImmutableMap instantiationTypes; - private final ImmutableMap typeMappings; - private final ImmutableMap additionalProperties; - private final ImmutableMap importMappings; - private final ImmutableSet languageSpecificPrimitives; - private final ImmutableMap reservedWordMappings; - private final ImmutableMap serverVariables; + private final Map instantiationTypes; + private final Map typeMappings; + private final Map additionalProperties; + private final Map importMappings; + private final Set languageSpecificPrimitives; + private final Map reservedWordMappings; + private final Map serverVariables; private String gitHost; private String gitUserId; @@ -348,12 +346,12 @@ public final class GeneratorSettings implements Serializable { artifactId = builder.artifactId; artifactVersion = builder.artifactVersion; library = builder.library; - instantiationTypes = ImmutableMap.copyOf(builder.instantiationTypes); - typeMappings = ImmutableMap.copyOf(builder.typeMappings); - importMappings = ImmutableMap.copyOf(builder.importMappings); - languageSpecificPrimitives = ImmutableSet.copyOf(builder.languageSpecificPrimitives); - reservedWordMappings = ImmutableMap.copyOf(builder.reservedWordMappings); - serverVariables = ImmutableMap.copyOf(builder.serverVariables); + instantiationTypes = Collections.unmodifiableMap(builder.instantiationTypes); + typeMappings = Collections.unmodifiableMap(builder.typeMappings); + importMappings = Collections.unmodifiableMap(builder.importMappings); + languageSpecificPrimitives = Collections.unmodifiableSet(builder.languageSpecificPrimitives); + reservedWordMappings = Collections.unmodifiableMap(builder.reservedWordMappings); + serverVariables = Collections.unmodifiableMap(builder.serverVariables); gitHost = builder.gitHost; gitUserId = builder.gitUserId; gitRepoId = builder.gitRepoId; @@ -408,7 +406,7 @@ public final class GeneratorSettings implements Serializable { additional.put("httpUserAgent", httpUserAgent); } - additionalProperties = ImmutableMap.copyOf(additional); + additionalProperties = Collections.unmodifiableMap(additional); } /** @@ -417,13 +415,13 @@ public final class GeneratorSettings implements Serializable { @SuppressWarnings("unused") public GeneratorSettings() { setDefaults(); - instantiationTypes = ImmutableMap.of(); - typeMappings = ImmutableMap.of(); - additionalProperties = ImmutableMap.of(); - importMappings = ImmutableMap.of(); - languageSpecificPrimitives = ImmutableSet.of(); - reservedWordMappings = ImmutableMap.of(); - serverVariables = ImmutableMap.of(); + instantiationTypes = Collections.unmodifiableMap(new HashMap<>(0)); + typeMappings = Collections.unmodifiableMap(new HashMap<>(0)); + additionalProperties = Collections.unmodifiableMap(new HashMap<>(0)); + importMappings = Collections.unmodifiableMap(new HashMap<>(0)); + languageSpecificPrimitives = Collections.unmodifiableSet(new HashSet<>(0)); + reservedWordMappings = Collections.unmodifiableMap(new HashMap<>(0)); + serverVariables = Collections.unmodifiableMap(new HashMap<>(0)); } private void setDefaults() { diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java index 0f2f605dd66..e2feddb9822 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java @@ -16,7 +16,6 @@ package org.openapitools.codegen.config; -import com.google.common.collect.ImmutableMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,10 +24,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Paths; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -51,7 +47,7 @@ public class WorkflowSettings { public static final boolean DEFAULT_STRICT_SPEC_BEHAVIOR = true; public static final boolean DEFAULT_GENERATE_ALIAS_AS_MODEL = false; public static final String DEFAULT_TEMPLATING_ENGINE_NAME = "mustache"; - public static final ImmutableMap DEFAULT_GLOBAL_PROPERTIES = ImmutableMap.of(); + public static final Map DEFAULT_GLOBAL_PROPERTIES = Collections.unmodifiableMap(new HashMap<>()); private String inputSpec; private String outputDir = DEFAULT_OUTPUT_DIR; @@ -68,7 +64,7 @@ public class WorkflowSettings { private String templateDir; private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME; private String ignoreFileOverride; - private ImmutableMap globalProperties = DEFAULT_GLOBAL_PROPERTIES; + private Map globalProperties = DEFAULT_GLOBAL_PROPERTIES; private WorkflowSettings(Builder builder) { this.inputSpec = builder.inputSpec; @@ -84,7 +80,7 @@ public class WorkflowSettings { this.templateDir = builder.templateDir; this.templatingEngineName = builder.templatingEngineName; this.ignoreFileOverride = builder.ignoreFileOverride; - this.globalProperties = ImmutableMap.copyOf(builder.globalProperties); + this.globalProperties = Collections.unmodifiableMap(builder.globalProperties); this.generateAliasAsModel = builder.generateAliasAsModel; } diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/FeatureSet.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/FeatureSet.java index 3ff23a51a39..db98fe2be7b 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/FeatureSet.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/FeatureSet.java @@ -16,7 +16,6 @@ package org.openapitools.codegen.meta; -import com.google.common.collect.ImmutableList; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.annotations.AnnotationType; @@ -203,7 +202,7 @@ public class FeatureSet { } public List getSource() { - return ImmutableList.copyOf(source); + return Collections.unmodifiableList(source); } } diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 4369c20c5e6..f782c3d8331 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -106,7 +106,7 @@ org.gradle gradle-tooling-api - ${gradleVersion} + 5.6.4 diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index f57ca1bb6e4..ffbcf5077bf 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -17,7 +17,6 @@ UTF-8 **/src/main/java/org/openapitools/codegen/plugin/**/* - 3.0.5 @@ -59,7 +58,7 @@ junit junit - + ${junit.version} test @@ -117,14 +116,6 @@ ${project.parent.basedir}${file.separator}google_checkstyle.xml - - net.revelc.code - formatter-maven-plugin - - - ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml - - diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index 0404dd529e8..644104a13e8 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -12,13 +12,8 @@ jar openapi-generator-online - 1.8 - ${java.version} - ${java.version} - 2.2.9.RELEASE + 2.5.5 3.0.0 - 4.13 - 2.10.2 **/org/openapitools/codegen/online/**/* @@ -26,7 +21,7 @@ org.springframework.boot spring-boot-dependencies - ${spring-boot-version} + ${spring-boot.version} pom import @@ -54,7 +49,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-version} + ${spring-boot.version} @@ -120,16 +115,6 @@ - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - jakarta.validation @@ -141,6 +126,12 @@ ${project.parent.version} + + junit + junit + ${junit.version} + test + org.springframework.boot spring-boot-starter-test @@ -151,12 +142,5 @@ spring-boot-test test - - org.hamcrest - java-hamcrest - 2.0.0.0 - test - - diff --git a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java index 14254c446a3..262e0eba660 100644 --- a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java +++ b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java @@ -28,7 +28,6 @@ public class GenApiControllerTest { @Autowired private MockMvc mockMvc; - @Test public void clientLanguages() throws Exception { getLanguages("clients", "java"); @@ -126,4 +125,4 @@ public class GenApiControllerTest { .andExpect(header().string(HttpHeaders.CONTENT_LENGTH, not(0))); } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index c27efbaf3e1..d6fde225783 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -27,17 +27,17 @@ org.jvnet.wagon-svn wagon-svn - 1.12 + ${wagon-svn.version} org.apache.maven.wagon wagon-ssh-external - 2.10 + ${wagon-ssh-external.version} org.apache.maven.wagon wagon-webdav - 1.0-beta-2 + ${wagon-webdav.version} target @@ -107,16 +107,16 @@ maven-compiler-plugin - 3.8.1 + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.source} org.apache.maven.plugins maven-jar-plugin - 3.1.0 + ${maven-jar-plugin.version} @@ -138,20 +138,12 @@ org.apache.maven.plugins maven-site-plugin - 3.7.1 + ${maven-site-plugin.version} org.apache.maven.plugins maven-release-plugin - 2.5.3 - - - net.revelc.code - formatter-maven-plugin - - - ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml - + ${maven-release-plugin.version} @@ -222,7 +214,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + ${maven-javadoc-plugin.version} true @@ -243,7 +235,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.0.0 + ${maven-project-info-reports-plugin.version} @@ -254,85 +246,71 @@ - - 1.3.0 - 26.0-jre - 1.0.2 - 1.3 - 2.10.1 - 2.10.0 - 1.3.60 - io.swagger.core.v3 swagger-core - ${swagger-core-version} + ${swagger-core.version} - ${swagger-parser-groupid} + ${swagger-parser-groupid.version} swagger-parser - ${swagger-parser-version} + ${swagger-parser.version} com.samskivert jmustache - ${jmustache-version} + ${jmustache.version} com.github.jknack handlebars - ${handlebars.java-version} + ${handlebars-java.version} com.github.jknack handlebars-jackson2 - ${handlebars.java-version} + ${handlebars-java.version} commons-io commons-io - ${commons-io-version} + ${commons-io.version} org.slf4j slf4j-ext - ${slf4j-version} + ${slf4j.version} org.slf4j slf4j-api - ${slf4j-version} + ${slf4j.version} org.slf4j slf4j-simple - ${slf4j-version} + ${slf4j.version} org.apache.commons commons-lang3 - ${commons-lang-version} + ${commons-lang.version} commons-cli commons-cli - ${commons-cli-version} + ${commons-cli.version} com.google.guava guava - ${guava-version} + ${guava.version} com.fasterxml.jackson.datatype jackson-datatype-guava - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} + ${jackson.version} com.tngtech.archunit @@ -349,7 +327,7 @@ org.testng testng - + ${testng.version} test @@ -361,13 +339,13 @@ org.reflections reflections - ${reflections-version} + ${reflections.version} test com.googlecode.java-diff-utils diffutils - ${diffutils-version} + ${diffutils.version} test @@ -378,33 +356,28 @@ org.mockito mockito-core - ${mockito-version} + ${mockito.version} test com.github.mifmif generex - ${generex-version} + ${generex.version} com.github.curious-odd-man rgxgen - ${rxgen-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} + ${rxgen.version} com.fasterxml.jackson.datatype jackson-datatype-joda - ${jackson-version} + ${jackson.version} com.github.joschi.jackson jackson-datatype-threetenbp - ${jackson-threetenbp-version} + ${jackson-threetenbp.version} org.openapitools @@ -414,19 +387,19 @@ org.jetbrains.kotlin kotlin-stdlib-jdk8 - ${kotlin-version} + ${kotlin.version} test org.jetbrains.kotlin kotlin-compiler-embeddable - ${kotlin-version} + ${kotlin.version} test org.jetbrains.kotlin kotlin-script-util - ${kotlin-version} + ${kotlin.version} test diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 0a8e7b31991..8d8e9cdc13e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -87,6 +87,15 @@ public class CodegenOperation { return nonempty(queryParams); } + /** + * Check if there's at least one query parameter or passing API keys in query + * + * @return true if query parameter exists or passing API keys in query, false otherwise + */ + public boolean getHasQueryParamsOrAuth() { + return getHasQueryParams() || (authMethods != null && authMethods.stream().anyMatch(authMethod -> authMethod.isKeyInQuery)); + } + /** * Check if there's at least one header parameter * 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 e76b174022d..8e76e62e56c 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 @@ -168,7 +168,7 @@ public class DefaultCodegen implements CodegenConfig { protected Map reservedWordsMappings = new HashMap(); protected String templateDir; protected String embeddedTemplateDir; - protected Map additionalProperties = new HashMap(); + protected Map additionalProperties = new HashMap<>(); protected Map serverVariables = new HashMap(); protected Map vendorExtensions = new HashMap(); /* @@ -387,7 +387,7 @@ public class DefaultCodegen implements CodegenConfig { * If common lambdas are not desired, override addMustacheLambdas() method * and return empty builder. * - * @return preinitialized map builder with common lambdas + * @return preinitialized map with common lambdas */ protected ImmutableMap.Builder addMustacheLambdas() { @@ -3419,7 +3419,7 @@ public class DefaultCodegen implements CodegenConfig { property.example = toExampleValue(p); } catch (Exception e) { LOGGER.error("Error in generating `example` for the property {}. Default to ERROR_TO_EXAMPLE_VALUE. Enable debugging for more info.", property.baseName); - LOGGER.debug("Exception from toExampleValue: {}", e); + LOGGER.debug("Exception from toExampleValue: {}", e.getMessage()); property.example = "ERROR_TO_EXAMPLE_VALUE"; } property.defaultValue = toDefaultValue(p); @@ -3574,13 +3574,13 @@ public class DefaultCodegen implements CodegenConfig { ; } - Boolean isAnyTypeWithNothingElseSet = (ModelUtils.isAnyType(p) && + boolean isAnyTypeWithNothingElseSet = (ModelUtils.isAnyType(p) && (p.getProperties() == null || p.getProperties().isEmpty()) && !ModelUtils.isComposedSchema(p) && p.getAdditionalProperties() == null && p.getNot() == null && p.getEnum() == null); if (!ModelUtils.isArraySchema(p) && !ModelUtils.isMapSchema(p) && !isFreeFormObject(p) && !isAnyTypeWithNothingElseSet) { - /** schemas that are not Array, not ModelUtils.isMapSchema, not isFreeFormObject, not AnyType with nothing else set + /* schemas that are not Array, not ModelUtils.isMapSchema, not isFreeFormObject, not AnyType with nothing else set * so primitve schemas int, str, number, referenced schemas, AnyType schemas with properties, enums, or composition */ String type = getSchemaType(p); @@ -3673,7 +3673,7 @@ public class DefaultCodegen implements CodegenConfig { protected Boolean isPropertyInnerMostEnum(CodegenProperty property) { CodegenProperty currentProperty = getMostInnerItems(property); - return currentProperty == null ? false : currentProperty.isEnum; + return currentProperty != null && currentProperty.isEnum; } protected CodegenProperty getMostInnerItems(CodegenProperty property) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index f720ce6901e..62e678621d4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -17,7 +17,6 @@ package org.openapitools.codegen; -import com.google.common.collect.ImmutableList; import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -112,7 +111,7 @@ public class DefaultGenerator implements Generator { this.config = opts.getConfig(); List userFiles = opts.getUserDefinedTemplates(); if (userFiles != null) { - this.userDefinedTemplates = ImmutableList.copyOf(userFiles); + this.userDefinedTemplates = Collections.unmodifiableList(userFiles); } TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(this.config.isEnableMinimalUpdate(),this.config.isSkipOverwrite()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DryRunTemplateManager.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DryRunTemplateManager.java index bbab6a854b5..aa8f8ef56ec 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DryRunTemplateManager.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DryRunTemplateManager.java @@ -1,12 +1,12 @@ package org.openapitools.codegen; -import com.google.common.collect.ImmutableMap; import org.openapitools.codegen.api.TemplateProcessor; import org.openapitools.codegen.templating.TemplateManagerOptions; import java.io.File; import java.io.IOException; import java.nio.file.Path; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -32,7 +32,7 @@ public class DryRunTemplateManager implements TemplateProcessor { * @return An immutable copy of the dry run status. */ public Map getDryRunStatusMap() { - return ImmutableMap.copyOf(dryRunStatusMap); + return Collections.unmodifiableMap(dryRunStatusMap); } /** diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ignore/CodegenIgnoreProcessor.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ignore/CodegenIgnoreProcessor.java index c1975e595c0..7c209aad3a0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ignore/CodegenIgnoreProcessor.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ignore/CodegenIgnoreProcessor.java @@ -17,8 +17,6 @@ package org.openapitools.codegen.ignore; -import com.google.common.collect.ImmutableList; -import com.google.common.io.Files; import org.openapitools.codegen.ignore.rules.DirectoryRule; import org.openapitools.codegen.ignore.rules.Rule; import org.slf4j.Logger; @@ -26,10 +24,10 @@ import org.slf4j.LoggerFactory; import java.io.*; import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Locale; +import java.nio.file.Files; +import java.util.*; + +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; /** * Presents a processing utility for parsing and evaluating files containing common ignore patterns. (.openapi-generator-ignore) @@ -91,7 +89,7 @@ public class CodegenIgnoreProcessor { if (legacyIgnoreFile.exists() && legacyIgnoreFile.isFile()) { LOGGER.info(String.format(Locale.ROOT, "Legacy support: '%s' file renamed to '%s'.", legacyIgnoreFile.getName(), targetIgnoreFile.getName())); try { - Files.move(legacyIgnoreFile, targetIgnoreFile); + Files.move(legacyIgnoreFile.toPath(), targetIgnoreFile.toPath(), REPLACE_EXISTING); loadFromFile(targetIgnoreFile); } catch (IOException e) { LOGGER.error(String.format(Locale.ROOT, "Could not rename file: %s", e.getMessage())); @@ -143,8 +141,8 @@ public class CodegenIgnoreProcessor { if(this.ignoreFile == null) return true; File file = new File(this.ignoreFile.getAbsoluteFile().getParentFile().toURI().relativize(targetFile.toURI()).getPath()); - Boolean directoryExcluded = false; - Boolean exclude = false; + boolean directoryExcluded = false; + boolean exclude = false; if(exclusionRules.size() == 0 && inclusionRules.size() == 0) { return true; } @@ -207,10 +205,10 @@ public class CodegenIgnoreProcessor { /** * Allows a consumer to manually inspect explicit "inclusion rules". That is, patterns in the ignore file which have been negated. * - * @return A {@link ImmutableList#copyOf(Collection)} of rules which possibly negate exclusion rules in the ignore file. + * @return A {@link Collections#unmodifiableList(List)} of rules which possibly negate exclusion rules in the ignore file. */ public List getInclusionRules() { - return ImmutableList.copyOf(inclusionRules); + return Collections.unmodifiableList(inclusionRules); } /** @@ -219,9 +217,9 @@ public class CodegenIgnoreProcessor { * * NOTE: Existence in this list doesn't mean a file is excluded. The rule can be overridden by {@link CodegenIgnoreProcessor#getInclusionRules()} rules. * - * @return A {@link ImmutableList#copyOf(Collection)} of rules which define exclusions by patterns in the ignore file. + * @return A {@link Collections#unmodifiableList(List)} of rules which define exclusions by patterns in the ignore file. */ public List getExclusionRules() { - return ImmutableList.copyOf(exclusionRules); + return Collections.unmodifiableList((exclusionRules)); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 25385064ced..086d63af29b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -17,7 +17,7 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.core.util.Json; @@ -393,7 +393,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("camelcase_param", new CamelCaseLambda().generator(this).escapeAsParamName(true)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java index 2adc4b8e1b2..a6950c776fe 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java @@ -17,7 +17,7 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.oas.models.OpenAPI; @@ -307,7 +307,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("multiline_comment_4", new IndentedLambda(4, " ", "///")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index c456b0438e3..f2d2bc289a6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -1,7 +1,5 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; @@ -114,13 +112,12 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { setReservedWordsLowerCase(reservedWordsList); // These types return isPrimitive=true in templates - languageSpecificPrimitives = Sets.newHashSet( - "String", - "bool", - "int", - "num", - "double" - ); + languageSpecificPrimitives = new HashSet<>(5); + languageSpecificPrimitives.add("String"); + languageSpecificPrimitives.add("bool"); + languageSpecificPrimitives.add("int"); + languageSpecificPrimitives.add("num"); + languageSpecificPrimitives.add("double"); typeMapping = new HashMap<>(); typeMapping.put("Array", "List"); @@ -151,18 +148,17 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { typeMapping.put("AnyType", "Object"); // Data types of the above values which are automatically imported - defaultIncludes = Sets.newHashSet( - "String", - "bool", - "int", - "num", - "double", - "List", - "Set", - "Map", - "DateTime", - "Object" - ); + defaultIncludes = new HashSet<>(); + defaultIncludes.add("String"); + defaultIncludes.add("bool"); + defaultIncludes.add("int"); + defaultIncludes.add("num"); + defaultIncludes.add("double"); + defaultIncludes.add("List"); + defaultIncludes.add("Set"); + defaultIncludes.add("Map"); + defaultIncludes.add("DateTime"); + defaultIncludes.add("Object"); imports.put("String", "dart:core"); imports.put("bool", "dart:core"); @@ -345,7 +341,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { // replace all characters that have a mapping but ignore underscores // append an underscore to each replacement so that it can be camelized if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { - name = escape(name, specialCharReplacements, Lists.newArrayList("_"), "_"); + name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_"); } // remove the rest name = sanitizeName(name); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java index 2bb25a1952b..e11579a2713 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java @@ -30,7 +30,6 @@ import org.slf4j.LoggerFactory; import java.util.*; -import static com.google.common.base.Strings.isNullOrEmpty; import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.underscore; @@ -268,13 +267,13 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - if (!isNullOrEmpty(model.parent)) { + if (StringUtils.isNotBlank(model.parent)) { parentModels.add(model.parent); if (!childrenByParent.containsEntry(model.parent, model)) { childrenByParent.put(model.parent, model); } } - if (!isNullOrEmpty(model.parentSchema)) { + if (StringUtils.isNotBlank(model.parentSchema)) { model.parentSchema = model.parentSchema.toLowerCase(Locale.ROOT); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java index a9140bd7dab..527481ecbdb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java @@ -16,7 +16,7 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.core.util.Json; @@ -306,7 +306,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("camelcase_param", new CamelCaseLambda().generator(this).escapeAsParamName(true)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index c6d71e3d6c1..77cd594f7fb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -17,67 +17,12 @@ package org.openapitools.codegen.languages; -import static org.openapitools.codegen.utils.StringUtils.camelize; -import static org.openapitools.codegen.utils.StringUtils.escape; -import static org.openapitools.codegen.utils.StringUtils.underscore; - -import java.io.File; -import java.time.LocalDate; -import java.time.ZoneId; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentSkipListSet; -import java.util.regex.Pattern; -import java.util.stream.Stream; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConfig; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenModel; -import org.openapitools.codegen.CodegenOperation; -import org.openapitools.codegen.CodegenParameter; -import org.openapitools.codegen.CodegenProperty; -import org.openapitools.codegen.DefaultCodegen; -import org.openapitools.codegen.meta.features.ClientModificationFeature; -import org.openapitools.codegen.meta.features.DocumentationFeature; -import org.openapitools.codegen.meta.features.GlobalFeature; -import org.openapitools.codegen.meta.features.SchemaSupportFeature; -import org.openapitools.codegen.meta.features.SecurityFeature; -import org.openapitools.codegen.meta.features.WireFormatFeature; -import org.openapitools.codegen.utils.ModelUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.google.common.base.Strings; -import com.google.common.collect.Sets; - 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.examples.Example; -import io.swagger.v3.oas.models.media.ArraySchema; -import io.swagger.v3.oas.models.media.Content; -import io.swagger.v3.oas.models.media.ComposedSchema; -import io.swagger.v3.oas.models.media.MediaType; -import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.servers.Server; @@ -96,6 +41,7 @@ import java.io.IOException; import java.time.LocalDate; import java.time.ZoneId; import java.util.*; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.regex.Pattern; import java.util.stream.Stream; @@ -347,7 +293,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code if (additionalProperties.containsKey(ADDITIONAL_MODEL_TYPE_ANNOTATIONS)) { String additionalAnnotationsList = additionalProperties.get(ADDITIONAL_MODEL_TYPE_ANNOTATIONS).toString(); - this.setAdditionalModelTypeAnnotations(new ArrayList<>(Sets.newHashSet(additionalAnnotationsList.trim().split("\\s*(;|\\r?\\n)\\s*")))); + this.setAdditionalModelTypeAnnotations(Arrays.asList(additionalAnnotationsList.trim().split("\\s*(;|\\r?\\n)\\s*"))); } if (additionalProperties.containsKey(ADDITIONAL_ENUM_TYPE_ANNOTATIONS)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index da93330eca2..e6f68a871a8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -603,6 +603,11 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co return sanitizeKotlinSpecificNames(modified); } + @Override + public String toEnumName(CodegenProperty property) { + return property.nameInCamelCase; + } + @Override public String toApiName(String name) { if (name.length() == 0) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 7c788c9316b..1059732e84e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -17,7 +17,6 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.Maps; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ComposedSchema; @@ -270,10 +269,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp return name.contains("&"); } - private Map toImportMap(String... names){ - Map result = Maps.newHashMap(); - for(String name: names){ - if(needToImport(name)){ + private Map toImportMap(String... names) { + Map result = new HashMap<>(); + for(final String name : names) { + if(needToImport(name)) { result.put(toModelImport(name), name); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 604fa336e38..ab5cd5bb3d0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -266,7 +266,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen { addSwitch(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES, CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES_DESC, this.optionalEmitDefaultValuesFlag); - + addSwitch(CodegenConstants.OPTIONAL_CONDITIONAL_SERIALIZATION, CodegenConstants.OPTIONAL_CONDITIONAL_SERIALIZATION_DESC, this.conditionalSerialization); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java index a6d17cbfbff..ca3e6c02f48 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java @@ -315,13 +315,14 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen { if (!foundInNewList) { if (op1.path.equals(op.path)) { foundInNewList = true; - List currentOtherMethodList = (List) op1.vendorExtensions.get("x-codegen-otherMethods"); + final String X_CODEGEN_OTHER_METHODS = "x-codegen-other-methods"; + List currentOtherMethodList = (List) op1.vendorExtensions.get(X_CODEGEN_OTHER_METHODS); if (currentOtherMethodList == null) { currentOtherMethodList = new ArrayList(); } op.operationIdCamelCase = op1.operationIdCamelCase; currentOtherMethodList.add(op); - op1.vendorExtensions.put("x-codegen-other-methods", currentOtherMethodList); + op1.vendorExtensions.put(X_CODEGEN_OTHER_METHODS, currentOtherMethodList); } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index b26f23891c0..25853e0b254 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -33,7 +33,6 @@ public class DartClientCodegen extends AbstractDartCodegen { private final Logger LOGGER = LoggerFactory.getLogger(DartClientCodegen.class); public static final String SERIALIZATION_LIBRARY_NATIVE = "native_serialization"; - public static final String SERIALIZATION_LIBRARY_JSON_SERIALIZABLE = "json_serializable"; public DartClientCodegen() { super(); @@ -43,7 +42,6 @@ public class DartClientCodegen extends AbstractDartCodegen { final Map serializationOptions = new HashMap<>(); serializationOptions.put(SERIALIZATION_LIBRARY_NATIVE, "Use native serializer, backwards compatible"); - serializationOptions.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "Use json_serializable. Experimental and subject to breaking changes without further notice"); serializationLibrary.setEnum(serializationOptions); cliOptions.add(serializationLibrary); } @@ -88,15 +86,7 @@ public class DartClientCodegen extends AbstractDartCodegen { LOGGER.info("Using serialization library {}", serialization_library); switch (serialization_library) { - case SERIALIZATION_LIBRARY_JSON_SERIALIZABLE: - additionalProperties.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "true"); - // json_serializable requires build.yaml - supportingFiles.add(new SupportingFile("build.yaml.mustache", - "" /* main project dir */, - "build.yaml")); - break; - - case SERIALIZATION_LIBRARY_NATIVE: // fall trough to default backwards compatible generator + case SERIALIZATION_LIBRARY_NATIVE: // fall through to default backwards compatible generator default: additionalProperties.put(SERIALIZATION_LIBRARY_NATIVE, "true"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java index 5bc677623de..9acfe364003 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java @@ -420,6 +420,8 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen { continue; } resultImports.add(i); + } else if (importMapping().containsKey(modelImport)) { + resultImports.add(importMapping().get(modelImport)); } else { resultImports.add("package:" + pubName + "/src/model/" + underscore(modelImport) + ".dart"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index aa43075765d..c6234ea8824 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -63,6 +63,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework"; public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles"; public static final String DYNAMIC_OPERATIONS = "dynamicOperations"; + public static final String GRADLE_PROPERTIES= "gradleProperties"; public static final String PLAY_24 = "play24"; public static final String PLAY_25 = "play25"; @@ -111,6 +112,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean caseInsensitiveResponseHeaders = false; protected boolean useAbstractionForFiles = false; protected boolean dynamicOperations = false; + protected String gradleProperties; protected String authFolder; protected String serializationLibrary = null; @@ -154,6 +156,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\"")); cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library")); cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); + cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle proeprties to the gradle.properties file")); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); @@ -318,8 +321,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen } additionalProperties.put(DYNAMIC_OPERATIONS, dynamicOperations); + if (additionalProperties.containsKey(GRADLE_PROPERTIES)) { + this.setGradleProperties(additionalProperties.get(GRADLE_PROPERTIES).toString()); + } + additionalProperties.put(GRADLE_PROPERTIES, gradleProperties); + final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); + final String modelsFolder = (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); //Common files @@ -379,6 +388,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen if (FEIGN.equals(getLibrary())) { modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); + //Templates to decode response headers + supportingFiles.add(new SupportingFile("model/ApiResponse.mustache", modelsFolder, "ApiResponse.java")); + supportingFiles.add(new SupportingFile("ApiResponseDecoder.mustache", invokerFolder, "ApiResponseDecoder.java")); } if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || RETROFIT_2.equals(getLibrary()) || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { @@ -423,7 +435,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen if (ProcessUtils.hasHttpSignatureMethods(openAPI)) { supportingFiles.add(new SupportingFile("auth/HttpSignatureAuth.mustache", authFolder, "HttpSignatureAuth.java")); } - supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. @@ -437,7 +449,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen setJava8ModeAndAdditionalProperties(true); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); - supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); } else if (RESTEASY.equals(getLibrary())) { setJava8ModeAndAdditionalProperties(true); @@ -980,6 +992,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.dynamicOperations = dynamicOperations; } + public void setGradleProperties(final String gradleProperties) { + this.gradleProperties= gradleProperties; + } + /** * Serialization library. * diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java index dfc6efdd69b..002084bc616 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java @@ -38,6 +38,7 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CodegenConfig; @@ -55,7 +56,6 @@ import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.collect.ImmutableMap.Builder; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Template; @@ -746,7 +746,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig { } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas().put("handleParamValue", new ParameterValueLambda()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index b4c47af501c..c08ecec4e23 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -16,7 +16,7 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Template; @@ -437,7 +437,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("escapeDoubleQuote", new EscapeLambda("\"", "\\\"")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java index 962ff922b5d..ad061e72c06 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java @@ -16,7 +16,6 @@ package org.openapitools.codegen.languages; -import com.google.common.base.Strings; import io.swagger.v3.oas.models.*; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.*; @@ -522,11 +521,11 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig @Override public String toModelFilename(String name) { - if (!Strings.isNullOrEmpty(modelNamePrefix)) { + if (!StringUtils.isBlank(modelNamePrefix)) { name = modelNamePrefix + "_" + name; } - if (!Strings.isNullOrEmpty(modelNameSuffix)) { + if (!StringUtils.isBlank(modelNameSuffix)) { name = name + "_" + modelNameSuffix; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java index 37e8472ec4c..d697fe54fa1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java @@ -17,13 +17,13 @@ package org.openapitools.codegen.languages; +import com.google.common.collect.ImmutableMap; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.templating.mustache.OnChangeLambda; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.collect.ImmutableMap.Builder; import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.oas.models.Operation; @@ -85,7 +85,7 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("onchange", new OnChangeLambda()); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index bfd61c2f8f9..6ca7dd832d0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -360,6 +360,10 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toVarName(String name) { + // translate @ for properties (like @type) to at_. + // Otherwise an additional "type" property will leed to duplcates + name = name.replaceAll("^@", "at_"); + // replace - with _ e.g. created-at => created_at name = sanitizeName(name.replaceAll("-", "_")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 9d6546d2ae5..cc8db68a316 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -420,6 +420,10 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toVarName(String name) { + // translate @ for properties (like @type) to at_. + // Otherwise an additional "type" property will leed to duplcates + name = name.replaceAll("^@", "at_"); + String sanitizedName = super.sanitizeName(name); // for reserved word, append _ if (isReservedWord(sanitizedName)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java index f38d42d1020..d918994d3ec 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java @@ -16,7 +16,7 @@ package org.openapitools.codegen.languages; -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.oas.models.media.ArraySchema; @@ -216,7 +216,7 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem } @Override - protected Builder addMustacheLambdas() { + protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() .put("indented_4", new IndentedLambda(4, " ")); } 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 0ea94726820..c0bc8e7cf42 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 @@ -17,34 +17,55 @@ package org.openapitools.codegen.languages; -import com.samskivert.mustache.Mustache; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.PathItem; +import static org.apache.commons.lang3.StringUtils.isNotEmpty; +import static org.openapitools.codegen.utils.StringUtils.camelize; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.Pair; -import org.openapitools.codegen.*; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.CodegenResponse; +import org.openapitools.codegen.CodegenSecurity; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.OptionalFeatures; import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures; -import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.GlobalFeature; +import org.openapitools.codegen.meta.features.ParameterFeature; +import org.openapitools.codegen.meta.features.SchemaSupportFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.templating.mustache.SplitStringLambda; import org.openapitools.codegen.templating.mustache.TrimWhitespaceLambda; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.net.URL; -import java.util.*; -import java.util.regex.Matcher; -import java.util.stream.Collectors; +import com.samskivert.mustache.Mustache; -import static org.apache.commons.lang3.StringUtils.isNotEmpty; -import static org.openapitools.codegen.utils.StringUtils.camelize; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; public class SpringCodegen extends AbstractJavaCodegen - implements BeanValidationFeatures, PerformBeanValidationFeatures, - OptionalFeatures { + implements BeanValidationFeatures, PerformBeanValidationFeatures, OptionalFeatures { private final Logger LOGGER = LoggerFactory.getLogger(SpringCodegen.class); public static final String TITLE = "title"; @@ -102,32 +123,16 @@ public class SpringCodegen extends AbstractJavaCodegen public SpringCodegen() { super(); - modifyFeatureSet(features -> features - .includeDocumentationFeatures(DocumentationFeature.Readme) + modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme) .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML, WireFormatFeature.Custom)) - .securityFeatures(EnumSet.of( - SecurityFeature.OAuth2_Implicit, - SecurityFeature.OAuth2_AuthorizationCode, - SecurityFeature.OAuth2_ClientCredentials, - SecurityFeature.OAuth2_Password, - SecurityFeature.ApiKey, - SecurityFeature.BasicAuth - )) - .excludeGlobalFeatures( - GlobalFeature.Callbacks, - GlobalFeature.LinkObjects, - GlobalFeature.ParameterStyling - ) - .includeGlobalFeatures( - GlobalFeature.XMLStructureDefinitions - ) - .includeSchemaSupportFeatures( - SchemaSupportFeature.Polymorphism - ) - .excludeParameterFeatures( - ParameterFeature.Cookie - ) - ); + .securityFeatures(EnumSet.of(SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_AuthorizationCode, + SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_Password, + SecurityFeature.ApiKey, SecurityFeature.BasicAuth)) + .excludeGlobalFeatures(GlobalFeature.Callbacks, GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling) + .includeGlobalFeatures(GlobalFeature.XMLStructureDefinitions) + .includeSchemaSupportFeatures(SchemaSupportFeature.Polymorphism) + .excludeParameterFeatures(ParameterFeature.Cookie)); outputFolder = "generated-code/javaSpring"; embeddedTemplateDir = templateDir = "JavaSpring"; @@ -150,43 +155,67 @@ public class SpringCodegen extends AbstractJavaCodegen additionalProperties.put("closebrace", CLOSE_BRACE); cliOptions.add(new CliOption(TITLE, "server title name or client service name").defaultValue(title)); - cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code").defaultValue(this.getConfigPackage())); - cliOptions.add(new CliOption(BASE_PACKAGE, "base package (invokerPackage) for generated code").defaultValue(this.getBasePackage())); - 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(new CliOption(CONFIG_PACKAGE, "configuration package for generated code") + .defaultValue(this.getConfigPackage())); + cliOptions.add(new CliOption(BASE_PACKAGE, "base package (invokerPackage) for generated code") + .defaultValue(this.getBasePackage())); + 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)); updateJava8CliOptions(); - cliOptions.add(CliOption.newBoolean(SKIP_DEFAULT_INTERFACE, "Whether to generate default implementations for java8 interfaces", skipDefaultInterface)); + cliOptions.add(CliOption.newBoolean(SKIP_DEFAULT_INTERFACE, + "Whether to generate default implementations for java8 interfaces", skipDefaultInterface)); 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(VIRTUAL_SERVICE, "Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki")); - cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames", useTags)); - cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation)); - cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Use Bean Validation Impl. to perform BeanValidation", performBeanValidation)); - cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", 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)); - cliOptions.add(CliOption.newBoolean(HATEOAS, "Use Spring HATEOAS library to allow adding HATEOAS links", hateoas)); - cliOptions.add(CliOption.newBoolean(RETURN_SUCCESS_CODE, "Generated server returns 2xx code", returnSuccessCode)); - cliOptions.add(CliOption.newBoolean(UNHANDLED_EXCEPTION_HANDLING, "Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).", unhandledException)); + 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, RxObservable, RxSingle or fully qualified type)")); + cliOptions.add(CliOption.newBoolean(VIRTUAL_SERVICE, + "Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki")); + cliOptions.add( + CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames", useTags)); + cliOptions + .add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation)); + cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, + "Use Bean Validation Impl. to perform BeanValidation", performBeanValidation)); + cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, + "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", + 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)); + cliOptions.add( + CliOption.newBoolean(HATEOAS, "Use Spring HATEOAS library to allow adding HATEOAS links", hateoas)); + cliOptions + .add(CliOption.newBoolean(RETURN_SUCCESS_CODE, "Generated server returns 2xx code", returnSuccessCode)); + cliOptions.add(CliOption.newBoolean(UNHANDLED_EXCEPTION_HANDLING, + "Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).", + unhandledException)); 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."); - supportedLibraries.put(SPRING_CLOUD_LIBRARY, "Spring-Cloud-Feign client with Spring-Boot auto-configured settings."); + supportedLibraries.put(SPRING_CLOUD_LIBRARY, + "Spring-Cloud-Feign client with Spring-Boot auto-configured settings."); setLibrary(SPRING_BOOT); - CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC).defaultValue(SPRING_BOOT); + final CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC) + .defaultValue(SPRING_BOOT); library.setEnum(supportedLibraries); cliOptions.add(library); } private void updateJava8CliOptions() { - CliOption option = cliOptions.stream().filter(o -> JAVA_8.equals(o.getOpt())).findFirst() + final CliOption option = cliOptions.stream().filter(o -> JAVA_8.equals(o.getOpt())).findFirst() .orElseThrow(() -> new RuntimeException("Missing java8 option")); - Map java8ModeOptions = option.getEnum(); - java8ModeOptions.put("true", "Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used. IMPORTANT: This option has been deprecated as Java 8 is the default."); + final Map java8ModeOptions = option.getEnum(); + java8ModeOptions.put("true", + "Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used. IMPORTANT: This option has been deprecated as Java 8 is the default."); } @Override @@ -207,25 +236,27 @@ public class SpringCodegen extends AbstractJavaCodegen @Override public void processOpts() { - List> configOptions = additionalProperties.entrySet().stream() + final 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()); + .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. + // Process java8 option before common java ones to change the default + // dateLibrary to java8. LOGGER.info("----------------------------------"); if (additionalProperties.containsKey(JAVA_8)) { this.setJava8(Boolean.parseBoolean(additionalProperties.get(JAVA_8).toString())); additionalProperties.put(JAVA_8, java8); - LOGGER.warn("java8 option has been deprecated as it's set to true by default (JDK7 support has been deprecated)"); + LOGGER.warn( + "java8 option has been deprecated as it's set to true by default (JDK7 support has been deprecated)"); } - if (this.java8 && !additionalProperties.containsKey(DATE_LIBRARY)) { + if (java8 && !additionalProperties.containsKey(DATE_LIBRARY)) { setDateLibrary("java8"); } - if (!additionalProperties.containsKey(BASE_PACKAGE) && additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + if (!additionalProperties.containsKey(BASE_PACKAGE) + && additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { // set invokerPackage as basePackage: this.setBasePackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); additionalProperties.put(BASE_PACKAGE, basePackage); @@ -236,7 +267,7 @@ public class SpringCodegen extends AbstractJavaCodegen // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment - //TODO: add doc templates + // TODO: add doc templates modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); @@ -273,12 +304,13 @@ public class SpringCodegen extends AbstractJavaCodegen } if (additionalProperties.containsKey(SKIP_DEFAULT_INTERFACE)) { - this.setSkipDefaultInterface(Boolean.parseBoolean(additionalProperties.get(SKIP_DEFAULT_INTERFACE).toString())); + this.setSkipDefaultInterface( + Boolean.parseBoolean(additionalProperties.get(SKIP_DEFAULT_INTERFACE).toString())); } if (additionalProperties.containsKey(ASYNC)) { this.setAsync(Boolean.parseBoolean(additionalProperties.get(ASYNC).toString())); - //fix for issue/1164 + // fix for issue/1164 convertPropertyToBooleanAndWriteBack(ASYNC); } @@ -316,7 +348,8 @@ public class SpringCodegen extends AbstractJavaCodegen } if (additionalProperties.containsKey(OPENAPI_DOCKET_CONFIG)) { - this.setOpenapiDocketConfig(Boolean.parseBoolean(additionalProperties.get(OPENAPI_DOCKET_CONFIG).toString())); + this.setOpenapiDocketConfig( + Boolean.parseBoolean(additionalProperties.get(OPENAPI_DOCKET_CONFIG).toString())); } if (additionalProperties.containsKey(API_FIRST)) { @@ -332,7 +365,8 @@ public class SpringCodegen extends AbstractJavaCodegen } if (additionalProperties.containsKey(UNHANDLED_EXCEPTION_HANDLING)) { - this.setUnhandledException(Boolean.parseBoolean(additionalProperties.get(UNHANDLED_EXCEPTION_HANDLING).toString())); + this.setUnhandledException( + Boolean.parseBoolean(additionalProperties.get(UNHANDLED_EXCEPTION_HANDLING).toString())); } additionalProperties.put(UNHANDLED_EXCEPTION_HANDLING, this.isUnhandledException()); @@ -343,9 +377,9 @@ public class SpringCodegen extends AbstractJavaCodegen writePropertyBack(USE_OPTIONAL, useOptional); } - if (this.interfaceOnly && this.delegatePattern) { - if (this.java8) { - this.delegateMethod = true; + if (interfaceOnly && delegatePattern) { + if (java8) { + delegateMethod = true; additionalProperties.put("delegate-method", true); } else { throw new IllegalArgumentException( @@ -357,28 +391,36 @@ public class SpringCodegen extends AbstractJavaCodegen supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - if (!this.interfaceOnly) { + if (!interfaceOnly) { if (SPRING_BOOT.equals(library)) { supportingFiles.add(new SupportingFile("openapi2SpringBoot.mustache", - (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "OpenAPI2SpringBoot.java")); + (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")); + (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), + "RFC3339DateFormat.java")); } if (SPRING_MVC_LIBRARY.equals(library)) { supportingFiles.add(new SupportingFile("webApplication.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "WebApplication.java")); supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebMvcConfiguration.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "WebMvcConfiguration.java")); supportingFiles.add(new SupportingFile("openapiUiConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIUiConfiguration.java")); + (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")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "RFC3339DateFormat.java")); } if (SPRING_CLOUD_LIBRARY.equals(library)) { supportingFiles.add(new SupportingFile("apiKeyRequestInterceptor.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "ApiKeyRequestInterceptor.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "ApiKeyRequestInterceptor.java")); supportingFiles.add(new SupportingFile("clientConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "ClientConfiguration.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "ClientConfiguration.java")); apiTemplateFiles.put("apiClient.mustache", "Client.java"); if (!additionalProperties.containsKey(SINGLE_CONTENT_TYPES)) { additionalProperties.put(SINGLE_CONTENT_TYPES, "true"); @@ -389,18 +431,21 @@ public class SpringCodegen extends AbstractJavaCodegen 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) { + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "HomeController.java")); + if (!reactive && !apiFirst) { supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java")); + (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 && !SPRING_CLOUD_LIBRARY.equals(library) && !this.reactive && !this.apiFirst) { + } else if (openapiDocketConfig && !SPRING_CLOUD_LIBRARY.equals(library) && !reactive && !apiFirst) { supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "OpenAPIDocumentationConfig.java")); } if (!SPRING_CLOUD_LIBRARY.equals(library)) { @@ -408,90 +453,86 @@ public class SpringCodegen extends AbstractJavaCodegen (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.java")); } - if (this.apiFirst) { + if (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")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "CustomInstantDeserializer.java")); if (SPRING_BOOT.equals(library) || SPRING_CLOUD_LIBRARY.equals(library)) { supportingFiles.add(new SupportingFile("jacksonConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "JacksonConfiguration.java")); + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), + "JacksonConfiguration.java")); } } - if ((!this.delegatePattern && this.java8) || this.delegateMethod) { + if ((!delegatePattern && java8) || delegateMethod) { additionalProperties.put("jdk8-no-delegate", true); } - - if (this.delegatePattern && !this.delegateMethod) { + if (delegatePattern && !delegateMethod) { additionalProperties.put("isDelegate", "true"); apiTemplateFiles.put("apiDelegate.mustache", "Delegate.java"); } - - if (this.java8) { + if (java8) { additionalProperties.put("javaVersion", "1.8"); if (SPRING_CLOUD_LIBRARY.equals(library)) { additionalProperties.put("jdk8-default-interface", false); } else { - additionalProperties.put("jdk8-default-interface", !this.skipDefaultInterface); + additionalProperties.put("jdk8-default-interface", !skipDefaultInterface); } additionalProperties.put("jdk8", true); - if (this.async) { + if (async) { additionalProperties.put(RESPONSE_WRAPPER, "CompletableFuture"); } - if (this.reactive) { + if (reactive) { additionalProperties.put(RESPONSE_WRAPPER, "Mono"); } - } else if (this.async) { + } else if (async) { additionalProperties.put(RESPONSE_WRAPPER, "Callable"); } - - if (!this.apiFirst && !this.reactive) { + if (!apiFirst && !reactive) { additionalProperties.put("useSpringfox", true); } - // Some well-known Spring or Spring-Cloud response wrappers - if (isNotEmpty(this.responseWrapper)) { + if (isNotEmpty(responseWrapper)) { additionalProperties.put("jdk8", false); additionalProperties.put("jdk8-default-interface", false); - switch (this.responseWrapper) { - case "Future": - case "Callable": - case "CompletableFuture": - additionalProperties.put(RESPONSE_WRAPPER, "java.util.concurrent." + this.responseWrapper); - break; - case "ListenableFuture": - additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.util.concurrent.ListenableFuture"); - break; - case "DeferredResult": - additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.web.context.request.async.DeferredResult"); - break; - case "HystrixCommand": - additionalProperties.put(RESPONSE_WRAPPER, "com.netflix.hystrix.HystrixCommand"); - break; - case "RxObservable": - additionalProperties.put(RESPONSE_WRAPPER, "rx.Observable"); - break; - case "RxSingle": - additionalProperties.put(RESPONSE_WRAPPER, "rx.Single"); - break; - default: - break; + switch (responseWrapper) { + case "Future": + case "Callable": + case "CompletableFuture": + additionalProperties.put(RESPONSE_WRAPPER, "java.util.concurrent." + responseWrapper); + break; + case "ListenableFuture": + additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.util.concurrent.ListenableFuture"); + break; + case "DeferredResult": + additionalProperties.put(RESPONSE_WRAPPER, + "org.springframework.web.context.request.async.DeferredResult"); + break; + case "RxObservable": + additionalProperties.put(RESPONSE_WRAPPER, "rx.Observable"); + break; + case "RxSingle": + additionalProperties.put(RESPONSE_WRAPPER, "rx.Single"); + break; + default: + break; } } // add lambda for mustache templates - additionalProperties.put("lambdaRemoveDoubleQuote", - (Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("")))); - additionalProperties.put("lambdaEscapeDoubleQuote", - (Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("\\\"")))); + additionalProperties.put("lambdaRemoveDoubleQuote", (Mustache.Lambda) (fragment, writer) -> writer + .write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("")))); + additionalProperties.put("lambdaEscapeDoubleQuote", (Mustache.Lambda) (fragment, writer) -> writer + .write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("\\\"")))); additionalProperties.put("lambdaRemoveLineBreak", (Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\\r|\\n", ""))); @@ -501,13 +542,14 @@ public class SpringCodegen extends AbstractJavaCodegen } @Override - public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { + public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, + Map> operations) { if ((SPRING_BOOT.equals(library) || SPRING_MVC_LIBRARY.equals(library)) && !useTags) { String basePath = resourcePath; if (basePath.startsWith("/")) { basePath = basePath.substring(1); } - int pos = basePath.indexOf("/"); + final int pos = basePath.indexOf("/"); if (pos > 0) { basePath = basePath.substring(0, pos); } @@ -517,7 +559,7 @@ public class SpringCodegen extends AbstractJavaCodegen } else { co.subresourceOperation = !co.path.isEmpty(); } - List opList = operations.computeIfAbsent(basePath, k -> new ArrayList<>()); + final List opList = operations.computeIfAbsent(basePath, k -> new ArrayList<>()); opList.add(co); co.baseName = basePath; } else { @@ -528,11 +570,10 @@ public class SpringCodegen extends AbstractJavaCodegen @Override public void preprocessOpenAPI(OpenAPI openAPI) { super.preprocessOpenAPI(openAPI); - /* TODO the following logic should not need anymore in OAS 3.0 - if ("/".equals(swagger.getBasePath())) { - swagger.setBasePath(""); - } - */ + /* + * TODO the following logic should not need anymore in OAS 3.0 if + * ("/".equals(swagger.getBasePath())) { swagger.setBasePath(""); } + */ if (!additionalProperties.containsKey(TITLE)) { // From the title, compute a reasonable name for the package and the API @@ -550,26 +591,26 @@ public class SpringCodegen extends AbstractJavaCodegen additionalProperties.put(TITLE, this.title); } - if(!additionalProperties.containsKey(SERVER_PORT)) { - URL url = URLPathUtils.getServerURL(openAPI, serverVariableOverrides()); - this.additionalProperties.put(SERVER_PORT, URLPathUtils.getPort(url, 8080)); + if (!additionalProperties.containsKey(SERVER_PORT)) { + final URL url = URLPathUtils.getServerURL(openAPI, serverVariableOverrides()); + additionalProperties.put(SERVER_PORT, URLPathUtils.getPort(url, 8080)); } if (openAPI.getPaths() != null) { - for (Map.Entry openAPIGetPathsEntry : openAPI.getPaths().entrySet()) { - String pathname = openAPIGetPathsEntry.getKey(); - PathItem path = openAPIGetPathsEntry.getValue(); + for (final Map.Entry openAPIGetPathsEntry : openAPI.getPaths().entrySet()) { + final String pathname = openAPIGetPathsEntry.getKey(); + final PathItem path = openAPIGetPathsEntry.getValue(); if (path.readOperations() != null) { - for (Operation operation : path.readOperations()) { + for (final Operation operation : path.readOperations()) { if (operation.getTags() != null) { - List> tags = new ArrayList>(); - for (String tag : operation.getTags()) { - Map value = new HashMap(); + final List> tags = new ArrayList<>(); + for (final String tag : operation.getTags()) { + final Map value = new HashMap<>(); value.put("tag", tag); tags.add(value); } if (operation.getTags().size() > 0) { - String tag = operation.getTags().get(0); + final String tag = operation.getTags().get(0); operation.setTags(Arrays.asList(tag)); } operation.addExtension("x-tags", tags); @@ -582,11 +623,11 @@ public class SpringCodegen extends AbstractJavaCodegen @Override public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + final Map operations = (Map) objs.get("operations"); if (operations != null) { - List ops = (List) operations.get("operation"); + final List ops = (List) operations.get("operation"); for (final CodegenOperation operation : ops) { - List responses = operation.responses; + final List responses = operation.responses; if (responses != null) { for (final CodegenResponse resp : responses) { if ("0".equals(resp.code)) { @@ -636,26 +677,27 @@ public class SpringCodegen extends AbstractJavaCodegen /** * @param returnType The return type that needs to be converted - * @param dataTypeAssigner An object that will assign the data to the respective fields in the model. + * @param dataTypeAssigner An object that will assign the data to the respective + * fields in the model. */ private void doDataTypeAssignment(String returnType, DataTypeAssigner dataTypeAssigner) { final String rt = returnType; if (rt == null) { dataTypeAssigner.setReturnType("Void"); } else if (rt.startsWith("List")) { - int end = rt.lastIndexOf(">"); + final int end = rt.lastIndexOf(">"); if (end > 0) { dataTypeAssigner.setReturnType(rt.substring("List<".length(), end).trim()); dataTypeAssigner.setReturnContainer("List"); } } else if (rt.startsWith("Map")) { - int end = rt.lastIndexOf(">"); + final int end = rt.lastIndexOf(">"); if (end > 0) { dataTypeAssigner.setReturnType(rt.substring("Map<".length(), end).split(",", 2)[1].trim()); dataTypeAssigner.setReturnContainer("Map"); } } else if (rt.startsWith("Set")) { - int end = rt.lastIndexOf(">"); + final int end = rt.lastIndexOf(">"); if (end > 0) { dataTypeAssigner.setReturnType(rt.substring("Set<".length(), end).trim()); dataTypeAssigner.setReturnContainer("Set"); @@ -675,7 +717,7 @@ public class SpringCodegen extends AbstractJavaCodegen final ArrayList copy = new ArrayList<>(allParams); allParams.clear(); - for (CodegenParameter p : copy) { + for (final CodegenParameter p : copy) { if (!p.isHeaderParam) { allParams.add(p); } @@ -686,9 +728,9 @@ public class SpringCodegen extends AbstractJavaCodegen public Map postProcessSupportingFileData(Map objs) { generateYAMLSpecFile(objs); if (SPRING_CLOUD_LIBRARY.equals(library)) { - List authMethods = (List) objs.get("authMethods"); + final List authMethods = (List) objs.get("authMethods"); if (authMethods != null) { - for (CodegenSecurity authMethod : authMethods) { + for (final CodegenSecurity authMethod : authMethods) { authMethod.name = camelize(sanitizeName(authMethod.name), true); } } @@ -724,7 +766,8 @@ public class SpringCodegen extends AbstractJavaCodegen if (example == null) { example = "/path/to/file"; } - example = "new org.springframework.core.io.FileSystemResource(new java.io.File(\"" + escapeText(example) + "\"))"; + example = "new org.springframework.core.io.FileSystemResource(new java.io.File(\"" + escapeText(example) + + "\"))"; p.example = example; } else { super.setParameterExampleValue(p); @@ -740,7 +783,7 @@ public class SpringCodegen extends AbstractJavaCodegen } public String getConfigPackage() { - return this.configPackage; + return configPackage; } public boolean isUnhandledException() { @@ -752,7 +795,7 @@ public class SpringCodegen extends AbstractJavaCodegen } public String getBasePackage() { - return this.basePackage; + return basePackage; } public void setInterfaceOnly(boolean interfaceOnly) { @@ -767,9 +810,13 @@ public class SpringCodegen extends AbstractJavaCodegen this.singleContentTypes = singleContentTypes; } - public void setSkipDefaultInterface(boolean skipDefaultInterface) { this.skipDefaultInterface = skipDefaultInterface; } + public void setSkipDefaultInterface(boolean skipDefaultInterface) { + this.skipDefaultInterface = skipDefaultInterface; + } - public void setJava8(boolean java8) { this.java8 = java8; } + public void setJava8(boolean java8) { + this.java8 = java8; + } public void setVirtualService(boolean virtualService) { this.virtualService = virtualService; @@ -823,7 +870,7 @@ public class SpringCodegen extends AbstractJavaCodegen property.example = null; } - //Add imports for Jackson + // Add imports for Jackson if (!Boolean.TRUE.equals(model.isEnum)) { model.imports.add("JsonProperty"); @@ -831,7 +878,7 @@ public class SpringCodegen extends AbstractJavaCodegen model.imports.add("JsonValue"); } } else { // enum class - //Needed imports for Jackson's JsonCreator + // Needed imports for Jackson's JsonCreator if (additionalProperties.containsKey(JACKSON)) { model.imports.add("JsonCreator"); } @@ -851,16 +898,16 @@ public class SpringCodegen extends AbstractJavaCodegen public Map postProcessModelsEnum(Map objs) { objs = super.postProcessModelsEnum(objs); - //Add imports for Jackson - List> imports = (List>) objs.get("imports"); - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); + // Add imports for Jackson + final List> imports = (List>) objs.get("imports"); + final List models = (List) objs.get("models"); + for (final Object _mo : models) { + final Map mo = (Map) _mo; + final CodegenModel cm = (CodegenModel) mo.get("model"); // for enum model if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { cm.imports.add(importMapping.get("JsonValue")); - Map item = new HashMap(); + final Map item = new HashMap<>(); item.put("import", importMapping.get("JsonValue")); imports.add(item); } @@ -869,10 +916,12 @@ public class SpringCodegen extends AbstractJavaCodegen return objs; } + @Override public void setUseBeanValidation(boolean useBeanValidation) { this.useBeanValidation = useBeanValidation; } + @Override public void setPerformBeanValidation(boolean performBeanValidation) { this.performBeanValidation = performBeanValidation; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 471ac31500f..ed922219016 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -314,7 +314,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege for (Object _mo : models) { Map mo = (Map) _mo; ExtendedCodegenModel cm = (ExtendedCodegenModel) mo.get("model"); - cm.imports = new TreeSet(cm.imports); + cm.imports = new TreeSet<>(cm.imports); this.processCodeGenModel(cm); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java index cbe94870103..5ecdf65d2bd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java @@ -17,7 +17,6 @@ package org.openapitools.codegen.utils; -import com.google.common.collect.ImmutableMap; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.ServerVariable; @@ -59,7 +58,7 @@ public class URLPathUtils { variables = new ServerVariables(); } - Map userVariables = userDefinedVariables == null ? new HashMap<>() : ImmutableMap.copyOf(userDefinedVariables); + Map userVariables = userDefinedVariables == null ? new HashMap<>() : Collections.unmodifiableMap(userDefinedVariables); if (StringUtils.isNotBlank(url)) { url = extractUrl(server, url, variables, userVariables); diff --git a/modules/openapi-generator/src/main/resources/Java/README.mustache b/modules/openapi-generator/src/main/resources/Java/README.mustache index cd2c7af3ee8..f360a2ac20d 100644 --- a/modules/openapi-generator/src/main/resources/Java/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/README.mustache @@ -21,7 +21,12 @@ Building the API client library requires: 1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +{{#jersey2}} +2. Maven (3.8.3+)/Gradle (7.2+) +{{/jersey2}} +{{^jersey2}} 2. Maven/Gradle +{{/jersey2}} ## Installation @@ -57,7 +62,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + repositories { + mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. + mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. + } + + dependencies { + implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + } ``` ### Others diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 6a12e63d329..2a8fa65cc5f 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -84,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 @@ -95,9 +93,13 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar and b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar differ diff --git a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache index 4d9ca164914..ffed3a254e9 100644 --- a/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.properties.mustache @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/modules/openapi-generator/src/main/resources/Java/gradle.properties.mustache b/modules/openapi-generator/src/main/resources/Java/gradle.properties.mustache index 05644f0754a..095ab31d11e 100644 --- a/modules/openapi-generator/src/main/resources/Java/gradle.properties.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradle.properties.mustache @@ -1,2 +1,9 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android +{{#gradleProperties}} +{{{.}}} +{{/gradleProperties}} diff --git a/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache index 107acd32c4e..6a68175eb70 100644 --- a/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/modules/openapi-generator/src/main/resources/Java/gradlew.mustache b/modules/openapi-generator/src/main/resources/Java/gradlew.mustache index 4f906e0c811..005bcde0428 100755 --- a/modules/openapi-generator/src/main/resources/Java/gradlew.mustache +++ b/modules/openapi-generator/src/main/resources/Java/gradlew.mustache @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache index 0e9d13beab5..5c4e78970ea 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -35,6 +35,7 @@ import feign.slf4j.Slf4jLogger; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.HttpBearerAuth; import {{invokerPackage}}.auth.ApiKeyAuth; +import {{invokerPackage}}.ApiResponseDecoder; {{#hasOAuthMethods}} import {{invokerPackage}}.auth.ApiErrorDecoder; @@ -63,7 +64,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new ApiResponseDecoder(objectMapper)) {{#hasOAuthMethods}} .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiResponseDecoder.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiResponseDecoder.mustache new file mode 100644 index 00000000000..ef171de9430 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiResponseDecoder.mustache @@ -0,0 +1,38 @@ +package {{invokerPackage}}; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import {{modelPackage}}.ApiResponse; + +public class ApiResponseDecoder extends JacksonDecoder { + + public ApiResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class ApiResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new ApiResponse(response.status(), responseHeaders, body); + } else { + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache index de0ae82baaa..c494070002d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache @@ -5,6 +5,7 @@ import {{invokerPackage}}.EncodingUtils; {{#legacyDates}} import {{invokerPackage}}.ParamExpander; {{/legacyDates}} +import {{modelPackage}}.ApiResponse; {{#imports}}import {{import}}; {{/imports}} @@ -49,8 +50,39 @@ public interface {{classname}} extends ApiClient.Api { {{/-last}}{{/headerParams}} }) {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - {{#hasQueryParams}} + /** + * {{summary}} + * Similar to {{operationId}} but it also returns the http response headers . + * {{notes}} +{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} +{{/allParams}} +{{#returnType}} + * @return A ApiResponse that wraps the response boyd and the http headers. +{{/returnType}} +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} +{{#isDeprecated}} + * @deprecated +{{/isDeprecated}} + */ +{{#isDeprecated}} + @Deprecated +{{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ +{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", +{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + + {{#hasQueryParams}} /** * {{summary}} * {{notes}} @@ -95,6 +127,47 @@ public interface {{classname}} extends ApiClient.Api { {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); /** + * {{summary}} + * {{notes}} + * Note, this is equivalent to the other {{operationId}} that receives the query parameters as a map, + * but this one also exposes the Http response headers + {{#allParams}} + {{^isQueryParam}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/isQueryParam}} + {{/allParams}} + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + {{#queryParams}} + *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • + {{/queryParams}} + *
+ {{#returnType}} + * @return {{.}} + {{/returnType}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ + {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", + {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * {{operationId}} method in a fluent style. */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/ApiErrorDecoder.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/ApiErrorDecoder.mustache index d3587925abf..da87f2563b1 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/ApiErrorDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/ApiErrorDecoder.mustache @@ -5,7 +5,7 @@ import feign.RetryableException; import feign.codec.ErrorDecoder; /** - * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token + * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token * All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder */ public class ApiErrorDecoder implements ErrorDecoder { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/ApiResponse.mustache new file mode 100644 index 00000000000..bc460dc59c0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/ApiResponse.mustache @@ -0,0 +1,43 @@ +package {{modelPackage}}; + +import java.util.Map; +import java.util.List; + +public class ApiResponse{ + + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } + +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 95c49396bfa..a56053fc829 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -83,7 +81,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -93,9 +91,13 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache index 2f049f273b9..6aba57ee04d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache @@ -142,7 +142,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/clientConfiguration.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/clientConfiguration.mustache index 3d0ccc7d2c5..1e9a0940ba2 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/clientConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/clientConfiguration.mustache @@ -21,7 +21,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; {{#authMethods}} {{#isOAuth}} -import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; +import org.springframework.cloud.openfeign.security.OAuth2FeignRequestInterceptor; import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; import org.springframework.security.oauth2.client.OAuth2ClientContext; {{#isApplication}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache index 3f35a15e30c..80453821f54 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.5.5 {{/parentOverridden}} @@ -35,7 +35,7 @@ org.springframework.cloud spring-cloud-starter-parent - Finchley.SR1 + 2020.0.4 pom import @@ -64,6 +64,7 @@ org.springframework.cloud spring-cloud-starter-oauth2 + 2.2.5.RELEASE {{#withXml}} @@ -98,7 +99,7 @@ org.openapitools jackson-databind-nullable {{^parentOverridden}} - 0.1.0 + 0.2.1 {{/parentOverridden}} {{/openApiNullable}} @@ -126,7 +127,7 @@ io.springfox springfox-swagger2 - 2.8.0 + 3.0.0 org.springframework.data diff --git a/modules/openapi-generator/src/main/resources/bash/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/bash/Dockerfile.mustache index d5d8a907a31..d7398be47e6 100644 --- a/modules/openapi-generator/src/main/resources/bash/Dockerfile.mustache +++ b/modules/openapi-generator/src/main/resources/bash/Dockerfile.mustache @@ -2,10 +2,10 @@ FROM alpine:3.12.0 RUN apk add --update --no-cache curl ca-certificates bash bash-completion zsh curl git vim ncurses util-linux -ADD {{scriptName}} /usr/bin/{{scriptName}} -ADD _{{scriptName}} /usr/local/share/zsh/site-functions/_{{scriptName}} -ADD {{scriptName}}.bash-completion /etc/bash-completion.d/{{scriptName}} -RUN chmod 755 /usr/bin/{{scriptName}} +ADD {{x-codegen-script-name}} /usr/bin/{{x-codegen-script-name}} +ADD _{{x-codegen-script-name}} /usr/local/share/zsh/site-functions/_{{x-codegen-script-name}} +ADD {{x-codegen-script-name}}.bash-completion /etc/bash-completion.d/{{x-codegen-script-name}} +RUN chmod 755 /usr/bin/{{x-codegen-script-name}} # # Install oh-my-zsh @@ -17,7 +17,7 @@ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh # RUN echo '\n\ . /etc/bash_completion\n\ -source /etc/bash-completion.d/{{scriptName}}\n\ +source /etc/bash-completion.d/{{x-codegen-script-name}}\n\ ' >> ~/.bashrc # @@ -51,13 +51,13 @@ For convenience, you can export the following environment variables:\n\ $(tput setaf 7)Basic usage:$(tput sgr0)\n\ \n\ $(tput setaf 3)Print the list of operations available on the service$(tput sgr0)\n\ -$ {{scriptName}} -h\n\ +$ {{x-codegen-script-name}} -h\n\ \n\ $(tput setaf 3)Print the service description$(tput sgr0)\n\ -$ {{scriptName}} --about\n\ +$ {{x-codegen-script-name}} --about\n\ \n\ $(tput setaf 3)Print detailed information about specific operation$(tput sgr0)\n\ -$ {{scriptName}} -h\n\ +$ {{x-codegen-script-name}} -h\n\ \n\ By default you are logged into Zsh with full autocompletion for your REST API,\n\ but you can switch to Bash, where basic autocompletion is also supported.\n\ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/README.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/README.mustache index c354a828080..b2fb51914a9 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/README.mustache @@ -1,3 +1,5 @@ +# C++ Qt API client + # {{artifactId}} {{appName}} @@ -16,55 +18,18 @@ *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* -## Licence - -{{licenseInfo}} - -for more information visit [{{licenseInfo}}]({{licenseUrl}}) ## Requirements Building the API client library requires: -1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+ -2. Maven/Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Generate manually - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Use the Jar file to generate the Qt Client: - -```shell -java -jar target/openapi-generator-cli.jar generate -i -g cpp-qt-client -o -``` +1. CMake 3.2+ +2. Qt +3. C++ Compiler ## Getting Started -Please follow the [installation](#installation) instruction and execute the following Java code: - example.h: - ```c++ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} #include @@ -82,8 +47,8 @@ public slots: }; {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} ``` -example.cpp: +example.cpp: ```c++ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} #include "../client/{{{classname}}}.h" @@ -132,25 +97,11 @@ void Example::exampleFunction1(){ {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} ``` -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - ## Documentation for Servers Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables: -``` +```yaml servers: - url: http://{server}:{port}/{basePath} description: Description of the Server @@ -170,20 +121,20 @@ servers: default: v1 ``` To change the default variable, use this function in each Api: -``` - int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); +```c++ +int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); ``` The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid. Variable is the name of the variable you wish to change and the value is the new default Value. The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found. If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function: -``` - void setServerIndex(const QString &operation, int serverIndex); +```c++ +void setServerIndex(const QString &operation, int serverIndex); ``` Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index. Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1. -``` +```yaml servers: - url: http://{server}:8080/ description: Description of the Server @@ -197,7 +148,6 @@ servers: - url: https://localhost:8080/v1 ``` - ## Documentation for Authorization {{^authMethods}}All endpoints do not require authorization. @@ -233,3 +183,7 @@ servers: {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} {{/-last}}{{/apis}}{{/apiInfo}} + +## License + +{{licenseInfo}} for more information visit [{{licenseInfo}}]({{licenseUrl}}) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-header.mustache index 08a12742d96..aef7227b79f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-header.mustache @@ -51,6 +51,7 @@ public: static utility::string_t parameterToString(float value); static utility::string_t parameterToString(double value); static utility::string_t parameterToString(const utility::datetime &value); + static utility::string_t parameterToString(bool value); template static utility::string_t parameterToString(const std::vector& value); template diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-source.mustache index d8e13ede3b9..24d3074b1e8 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/apiclient-source.mustache @@ -79,6 +79,13 @@ utility::string_t ApiClient::parameterToString(const utility::datetime &value) return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601)); } +utility::string_t ApiClient::parameterToString(bool value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << std::boolalpha << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} + pplx::task ApiClient::callApi( const utility::string_t& path, const utility::string_t& method, diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index f9714b7b63f..8a42acff92f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -10,6 +10,55 @@ namespace {{this}} { {{#isEnum}} +namespace +{ +using EnumUnderlyingType = {{#isNumeric}}int64_t{{/isNumeric}}{{^isNumeric}}utility::string_t{{/isNumeric}}; + +{{classname}}::e{{classname}} toEnum(const EnumUnderlyingType& val) +{ +{{#allowableValues}} +{{#isNumeric}} + switch (val) + { + {{#enumVars}} + case {{value}}: + return {{classname}}::e{{classname}}::{{classname}}_{{name}}; + {{#-last}} + default: + break; + {{/-last}} + {{/enumVars}} + } +{{/isNumeric}} +{{^isNumeric}} + {{#enumVars}} + if (val == utility::conversions::to_string_t(U("{{{value}}}"))) + return {{classname}}::e{{classname}}::{{classname}}_{{name}}; + {{/enumVars}} +{{/isNumeric}} +{{/allowableValues}} + return {}; +} + +EnumUnderlyingType fromEnum({{classname}}::e{{classname}} e) +{ +{{#allowableValues}} + switch (e) + { +{{#enumVars}} + case {{classname}}::e{{classname}}::{{classname}}_{{name}}: + return {{#isNumeric}}{{value}}{{/isNumeric}}{{^isNumeric}}U("{{value}}"){{/isNumeric}}; +{{#-last}} + default: + break; +{{/-last}} +{{/enumVars}} + } +{{/allowableValues}} + return {}; +} +} + {{classname}}::{{classname}}() { } @@ -25,56 +74,44 @@ void {{classname}}::validate() web::json::value {{classname}}::toJson() const { - web::json::value val = web::json::value::object(); - - {{#allowableValues}}{{#enumVars}} - if (m_value == e{{classname}}::{{classname}}_{{name}}) val = web::json::value::string(U({{{value}}}));{{/enumVars}}{{/allowableValues}} - - return val; + auto val = fromEnum(m_value); + return web::json::value(val); } bool {{classname}}::fromJson(const web::json::value& val) { - auto s = val.as_string(); - - {{#allowableValues}}{{#enumVars}} - if (s == utility::conversions::to_string_t({{{value}}})) m_value = e{{classname}}::{{classname}}_{{name}};{{/enumVars}}{{/allowableValues}} + m_value = toEnum({{#isNumeric}}val.as_number().to_int64(){{/isNumeric}}{{^isNumeric}}val.as_string(){{/isNumeric}}); return true; } void {{classname}}::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if (!namePrefix.empty() && namePrefix.back() != U('.')) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix.push_back(U('.')); } - utility::string_t s; - - {{#allowableValues}}{{#enumVars}} - if (m_value == e{{classname}}::{{classname}}_{{name}}) s = utility::conversions::to_string_t({{{value}}});{{/enumVars}}{{/allowableValues}} - - multipart->add(ModelBase::toHttpContent(namePrefix, s)); + auto e = fromEnum(m_value); + multipart->add(ModelBase::toHttpContent(namePrefix, e)); } bool {{classname}}::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if (!namePrefix.empty() && namePrefix.back() != U('.')) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix.push_back(U('.')); } { - utility::string_t s; - ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), s); - e{{classname}} v; - - {{#allowableValues}}{{#enumVars}} - if (s == utility::conversions::to_string_t({{{value}}})) v = e{{classname}}::{{classname}}_{{name}};{{/enumVars}}{{/allowableValues}} - - setValue(v); + EnumUnderlyingType e; + ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e); + if (ok) + { + auto v = toEnum(e); + setValue(v); + } } return ok; } @@ -134,7 +171,7 @@ web::json::value {{classname}}::toJson() const {{#vars}}{{^isInherited}} if(m_{{name}}IsSet) { - val[utility::conversions::to_string_t("{{baseName}}")] = ModelBase::toJson(m_{{name}}); + val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); }{{/isInherited}}{{/vars}} return val; @@ -147,9 +184,9 @@ bool {{classname}}::fromJson(const web::json::value& val) ok &= this->{{{.}}}::fromJson(val); {{/parent}} {{#vars}}{{^isInherited}} - if(val.has_field(utility::conversions::to_string_t("{{baseName}}"))) + if(val.has_field(utility::conversions::to_string_t(U("{{baseName}}")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("{{baseName}}")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("{{baseName}}"))); if(!fieldValue.is_null()) { {{{dataType}}} refVal_{{baseName}}; @@ -163,14 +200,14 @@ bool {{classname}}::fromJson(const web::json::value& val) void {{classname}}::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } {{#vars}} if(m_{{name}}IsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("{{baseName}}"), m_{{name}})); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); } {{/vars}} } @@ -179,16 +216,16 @@ bool {{classname}}::fromMultiPart(std::shared_ptr multipart, { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } {{#vars}} - if(multipart->hasContent(utility::conversions::to_string_t("{{baseName}}"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("{{baseName}}")))) { {{{dataType}}} refVal_{{baseName}}; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("{{baseName}}")), refVal_{{baseName}} ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("{{baseName}}"))), refVal_{{baseName}} ); {{setter}}(refVal_{{baseName}}); } {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-header.mustache index 30e1154cff5..80c7b0d4dd7 100644 --- a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-header.mustache @@ -11,10 +11,13 @@ {{{defaultInclude}}} #include #include +#include #include #include +#include #include +#include {{#imports}}{{{import}}} {{/imports}} @@ -25,6 +28,22 @@ namespace {{this}} { using namespace {{modelNamespace}}; +/// +/// Exception to flag problems in the handlers +/// +class {{declspec}} {{classname}}Exception: public std::exception +{ +public: + {{classname}}Exception(int status_code, std::string what); + + int getStatus() const; + const char* what() const noexcept override; + +private: + int m_status; + std::string m_what; +}; + {{#operation}} /// /// {{summary}} @@ -35,60 +54,143 @@ using namespace {{modelNamespace}}; class {{declspec}} {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource: public restbed::Resource { public: - {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(); + {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(const std::string& context = "{{contextPath}}"); virtual ~{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(); - void {{httpMethod}}_method_handler(const std::shared_ptr session); + +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + + virtual {{#returnType}}std::pair{{/returnType}}{{^returnType}}int{{/returnType}} handler_{{httpMethod}}( + {{#allParams}}{{{dataType}}} const & {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#vendorExtensions.x-codegen-other-methods}} - void {{httpMethod}}_method_handler(const std::shared_ptr session); + virtual {{#returnType}}std::pair{{/returnType}}{{^returnType}}int{{/returnType}} handler_{{httpMethod}}( + {{#allParams}}{{{dataType}}} const & {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); {{/vendorExtensions.x-codegen-other-methods}} - void set_handler_{{httpMethod}}( - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler - ); +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// - {{#vendorExtensions.x-codegen-other-methods}} - void set_handler_{{httpMethod}}( - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler - ); - {{/vendorExtensions.x-codegen-other-methods}} + virtual std::string extractBodyContent(const std::shared_ptr& session); + + {{#hasPathParams}} + {{#pathParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getPathParam_{{{paramName}}}(const std::shared_ptr& request) + { + return request->get_path_parameter("{{{paramName}}}", {{{defaultValue}}}); + } + + {{/isPrimitiveType}} + {{/pathParams}} + {{/hasPathParams}} + {{#hasQueryParams}} + {{#queryParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getQueryParam_{{{paramName}}}(const std::shared_ptr& request) + { + return request->get_query_parameter("{{{paramName}}}", {{{defaultValue}}}); + } + + {{/isPrimitiveType}} + {{/queryParams}} + {{/hasQueryParams}} + {{#hasHeaderParams}} + {{#headerParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getHeader_{{{baseName}}}(const std::shared_ptr& request) + { + return request->get_header("{{baseName}}", {{{defaultValue}}}); + } + + {{/isPrimitiveType}} + {{/headerParams}} + {{/hasHeaderParams}} + + {{#vendorExtensions.x-codegen-other-methods}} + {{#hasPathParams}} + {{#pathParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getPathParam_{{{paramName}}}_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("{{{paramName}}}", {{{defaultValue}}}); + } + {{/isPrimitiveType}} + {{/pathParams}} + {{/hasPathParams}} + {{#hasQueryParams}} + {{#queryParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getQueryParam_{{{paramName}}}_x_extension(const std::shared_ptr& request) + { + return request->get_query_parameter("{{{paramName}}}", {{{defaultValue}}}); + } + {{/isPrimitiveType}} + {{/queryParams}} + {{/hasQueryParams}} + {{#hasHeaderParams}} + {{#headerParams}} + {{#isPrimitiveType}} + virtual {{{dataType}}} getHeader_{{{baseName}}}_x_extension(const std::shared_ptr& request) + { + return request->get_header("{{baseName}}", {{{defaultValue}}}); + } + {{/isPrimitiveType}} + {{/headerParams}} + {{/hasHeaderParams}} + {{/vendorExtensions.x-codegen-other-methods}} + + virtual std::pair handle{{classname}}Exception(const {{classname}}Exception& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler_{{httpMethod}}_; - - {{#vendorExtensions.x-codegen-other-methods}} - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler_{{httpMethod}}_; - {{/vendorExtensions.x-codegen-other-methods}} - - {{#allParams}} - {{{dataType}}} {{paramName}}{}; - {{/allParams}} + void handler_{{httpMethod}}_internal(const std::shared_ptr session); + {{#vendorExtensions.x-codegen-other-methods}} + void handler_{{httpMethod}}_internal(const std::shared_ptr session); + {{/vendorExtensions.x-codegen-other-methods}} }; + {{/operation}} // // The restbed service to actually implement the REST server // -class {{declspec}} {{classname}}: public restbed::Service +class {{declspec}} {{classname}} { public: - {{classname}}(); - ~{{classname}}(); - void startService(int const& port); - void stopService(); + explicit {{classname}}(std::shared_ptr const& restbedService); + virtual ~{{classname}}(); + + {{#operation}} + virtual void set{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource> sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource); + {{/operation}} + + virtual void publishDefaultResources(); + + virtual std::shared_ptr service(); protected: {{#operation}} std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource> m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource; {{/operation}} + +private: + std::shared_ptr m_service; }; diff --git a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache index e80c89321fc..6a9c99ab284 100644 --- a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache @@ -5,6 +5,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "{{classname}}.h" @@ -14,43 +19,73 @@ namespace {{this}} { using namespace {{modelNamespace}}; -{{classname}}::{{classname}}() { +{{classname}}Exception::{{classname}}Exception(int status_code, std::string what) + : m_status(status_code), + m_what(what) +{ + +} +int {{classname}}Exception::getStatus() const +{ + return m_status; +} +const char* {{classname}}Exception::what() const noexcept +{ + return m_what.c_str(); } -{{classname}}::~{{classname}}() {} -void {{classname}}::startService(int const& port) { - // A typical pattern is to derive a class from {{classname}} and allocate the shared pointers for restbed::Resource objects - // and manipulate them (e.g. binding GET/POST handler functions) before this startService() gets called. - // In such a case we want to use our m_spXXX variables. - // However in case these shared pointers are nullptr, then allocate the restbed::Resources now: - {{#operation}} - if (!m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource) - m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource = std::make_shared<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource>(); - this->publish(m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource); - {{/operation}} +template +std::shared_ptr extractJsonModelBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); - std::shared_ptr settings = std::make_shared(); - settings->set_port(port); - settings->set_root("{{contextPath}}"); - - this->start(settings); + auto model = std::make_shared(pt); + return model; } -void {{classname}}::stopService() { - this->stop(); +template +std::vector> extractJsonArrayBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto arrayRet = std::vector>(); + for (const auto& child: pt) { + arrayRet.emplace_back(std::make_shared(child.second)); + } + return arrayRet; +} + +template +std::string convertMapResponse(const std::map& map) +{ + boost::property_tree::ptree pt; + for(const auto &kv: map) { + pt.push_back(boost::property_tree::ptree::value_type( + boost::lexical_cast(kv.first), + boost::property_tree::ptree( + boost::lexical_cast(kv.second)))); + } + std::stringstream sstream; + write_json(sstream, pt); + std::string result = sstream.str(); + return result; } {{#operation}} -{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource() +{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(const std::string& context /* = "{{contextPath}}" */) { - this->set_path("{{path}}"); + this->set_path(context + "{{path}}"); this->set_method_handler("{{httpMethod}}", - std::bind(&{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{httpMethod}}_method_handler, this, + std::bind(&{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}_internal, this, std::placeholders::_1)); {{#vendorExtensions.x-codegen-other-methods}} this->set_method_handler("{{httpMethod}}", - std::bind(&{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{httpMethod}}_method_handler, this, + std::bind(&{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}_internal, this, std::placeholders::_1)); {{/vendorExtensions.x-codegen-other-methods}} } @@ -59,169 +94,305 @@ void {{classname}}::stopService() { { } -void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::set_handler_{{httpMethod}}( - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler) { - handler_{{httpMethod}}_ = std::move(handler); +std::pair {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handle{{classname}}Exception(const {{classname}}Exception& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + {{#hasBodyParam}} + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + {{#allParams}} + {{#isModel}} + auto {{paramName}} = extractJsonModelBodyParam<{{{baseType}}}>(bodyContent); + {{/isModel}} + {{#isArray}} + auto {{paramName}} = extractJsonArrayBodyParam<{{{baseType}}}>(bodyContent); + {{/isArray}} + {{/allParams}} + {{/hasBodyParam}} + + {{#hasPathParams}} + // Getting the path params + {{#pathParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getPathParam_{{paramName}}(request); + {{/isPrimitiveType}} + {{/pathParams}} + {{/hasPathParams}} + + {{#hasQueryParams}} + // Getting the query params + {{#queryParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getQueryParam_{{paramName}}(request); + {{/isPrimitiveType}} + {{/queryParams}} + {{/hasQueryParams}} + + {{#hasHeaderParams}} + // Getting the headers + {{#headerParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getHeader_{{baseName}}(request); + {{/isPrimitiveType}} + {{/headerParams}} + {{/hasHeaderParams}} + + int status_code = 500; + {{#returnType}} + {{{.}}} resultObject = {{{defaultResponse}}}; + {{/returnType}} + std::string result = ""; + + try { + {{#returnType}} + std::tie(status_code, resultObject) = + {{/returnType}} + {{^returnType}} + status_code = + {{/returnType}} + handler_{{httpMethod}}({{#allParams}}{{paramName}}{{^-last}}, {{ / -last}}{{ / allParams}}); + } + catch(const {{classname}}Exception& e) { + std::tie(status_code, result) = handle{{classname}}Exception(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + {{#responses}} + if (status_code == {{code}}) { + {{#returnType}} + {{#isModel}} + {{#isString}} + result = resultObject; + {{/isString}} + {{^isString}} + result = resultObject->toJsonString(); + {{/isString}} + {{/isModel}} + {{#isMap}} + result = convertMapResponse(resultObject); + {{/isMap}} + {{/returnType}} + {{#headers}} + // Description: {{{description}}} + setResponseHeader(session, "{{baseName}}"); + {{/headers}} + + {{#primitiveType}} + const constexpr auto contentType = "text/plain"; + {{/primitiveType}} + {{^primitiveType}} + const constexpr auto contentType = "application/json"; + {{/primitiveType}} + returnResponse(session, {{code}}, result.empty() ? "{{message}}" : result, contentType); + return; + } + {{/responses}} + defaultSessionClose(session, status_code, result); } {{#vendorExtensions.x-codegen-other-methods}} -void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::set_handler_{{httpMethod}}( - std::function( - {{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}} - )> handler) { - handler_{{httpMethod}}_ = std::move(handler); +// x-extension +void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + {{#hasBodyParam}} + std::string bodyContent = extractBodyContent(session); + + // body params or form params here from the body content string + {{#allParams}} + {{#isModel}} + auto {{paramName}} = extractJsonModelBodyParam<{{{baseType}}}>(bodyContent); + {{/isModel}} + {{#isArray}} + auto {{paramName}} = extractJsonArrayBodyParam<{{{baseType}}}>(bodyContent); + {{/isArray}} + {{^isModel}} + {{^isArray}} + auto {{paramName}} = std::make_shared<{{{baseType}}}>(bodyContent); + {{/isArray}} + {{/isModel}} + {{/allParams}} + {{/hasBodyParam}} + + {{#hasPathParams}} + // Getting the path params + {{#pathParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getPathParam_{{paramName}}_x_extension(request); + + {{/isPrimitiveType}} + {{/pathParams}} + {{/hasPathParams}} + {{#hasQueryParams}} + // Getting the query params + {{#queryParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getQueryParam_{{paramName}}_x_extension(request); + + {{/isPrimitiveType}} + {{/queryParams}} + {{/hasQueryParams}} + {{#hasHeaderParams}} + // Getting the headers + {{#headerParams}} + {{#isPrimitiveType}} + const {{{dataType}}} {{{paramName}}} = getHeader_{{baseName}}_x_extension(request); + + {{/isPrimitiveType}} + {{/headerParams}} + {{/hasHeaderParams}} + + int status_code = 500; + {{#returnType}} + {{{.}}} resultObject = {{{defaultResponse}}}; + {{/returnType}} + std::string result = ""; + + try { + {{#returnType}} + std::tie(status_code, resultObject) = + {{/returnType}} + {{^returnType}} + status_code = + {{/returnType}} + handler_{{httpMethod}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + catch(const {{classname}}Exception& e) { + std::tie(status_code, result) = handle{{classname}}Exception(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + {{#responses}} + if (status_code == {{code}}) { + {{#returnType}} + {{#isModel}} + {{#isString}} + result = resultObject; + {{/isString}} + {{^isString}} + result = resultObject->toJsonString(); + {{/isString}} + {{/isModel}} + {{#isMap}} + result = convertMapResponse(resultObject); + {{/isMap}} + {{/returnType}} + {{#headers}} + // Description: {{{description}}} + setResponseHeader(session, "{{baseName}}"); + {{/headers}} + + {{#primitiveType}} + const constexpr auto contentType = "text/plain"; + {{/primitiveType}} + {{^primitiveType}} + const constexpr auto contentType = "application/json"; + {{/primitiveType}} + returnResponse(session, {{code}}, result.empty() ? "{{message}}" : result, contentType); + return; + } + {{/responses}} + defaultSessionClose(session, status_code, result); } {{/vendorExtensions.x-codegen-other-methods}} -void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - {{#hasBodyParam}} - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - {{/hasBodyParam}} - - {{#hasPathParams}} - // Getting the path params - {{#pathParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_path_parameter("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/pathParams}} - {{/hasPathParams}} - - {{#hasQueryParams}} - // Getting the query params - {{#queryParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_query_parameter("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/queryParams}} - {{/hasQueryParams}} - - {{#hasHeaderParams}} - // Getting the headers - {{#headerParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_header("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/headerParams}} - {{/hasHeaderParams}} - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_{{httpMethod}}_) - { - std::tie(status_code, result) = handler_{{httpMethod}}_( - {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} - ); - } - - {{#responses}} - if (status_code == {{code}}) { - {{#headers}} - // Description: {{description}} - session->set_header("{{baseName}}", ""); // Change second param to your header value - {{/headers}} - session->close({{code}}, result.empty() ? "{{message}}" : std::move(result), { {"Connection", "close"} }); - return; - } - {{/responses}} - - {{#hasBodyParam}} - }); - {{/hasBodyParam}} +{{#returnType}}std::pair{{/returnType}}{{^returnType}}int{{/returnType}} {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}( + {{#allParams}}{{{dataType}}} const & {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +{ + throw {{classname}}Exception(501, "Not implemented"); } {{#vendorExtensions.x-codegen-other-methods}} -void {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - {{#hasBodyParam}} - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - {{/hasBodyParam}} - - {{#hasPathParams}} - // Getting the path params - {{#pathParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_path_parameter("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/pathParams}} - {{/hasPathParams}} - - {{#hasQueryParams}} - // Getting the query params - {{#queryParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_query_parameter("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/queryParams}} - {{/hasQueryParams}} - - {{#hasHeaderParams}} - // Getting the headers - {{#headerParams}} - {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_header("{{paramName}}", {{{defaultValue}}}); - {{/isPrimitiveType}} - {{/headerParams}} - {{/hasHeaderParams}} - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_{{httpMethod}}_) - { - std::tie(status_code, result) = handler_{{httpMethod}}_( - {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} - ); - } - - {{#responses}} - if (status_code == {{code}}) { - {{#baseType}} - std::shared_ptr<{{.}}> response = NULL; - {{/baseType}} - {{#headers}} - // Description: {{description}} - session->set_header("{{baseName}}", ""); // Change second param to your header value - {{/headers}} - session->close({{code}}, result.empty() ? "{{message}}" : std::move(result), { {"Connection", "close"} }); - return; - } - {{/responses}} - - {{#hasBodyParam}} - }); - {{/hasBodyParam}} +{{#returnType}}std::pair{{/returnType}}{{^returnType}}int{{/returnType}} {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}( + {{#allParams}}{{{dataType}}} const & {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +{ + throw {{classname}}Exception(501, "Not implemented"); } {{/vendorExtensions.x-codegen-other-methods}} - +std::string {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} {{/operation}} +{{classname}}::{{classname}}(std::shared_ptr const& restbedService) +: m_service(restbedService) +{ +} + +{{classname}}::~{{classname}}() {} + +{{#operation}} +void {{classname}}::set{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource> sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource) { + m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource = sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource; + m_service->publish(m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource); +} +{{/operation}} + + +void {{classname}}::publishDefaultResources() { + {{#operation}} + if (!m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource) { + set{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource(std::make_shared<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource>()); + } + {{/operation}} +} + +std::shared_ptr {{classname}}::service() { + return m_service; +} + + {{#apiNamespaceDeclarations}} } {{/apiNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-header.mustache index 805b0664ab2..2568ccb6766 100644 --- a/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-header.mustache @@ -13,6 +13,10 @@ {{#imports}}{{{this}}} {{/imports}} #include +#include +{{#hasEnums}} +#include +{{/hasEnums}} #include {{#modelNamespaceDeclarations}} @@ -28,8 +32,9 @@ class {{{this}}}; class {{declspec}} {{classname}} {{#interfaces}}{{#-first}}:{{/-first}}{{^-first}},{{/-first}} public {{{this}}}{{/interfaces}} { public: - {{classname}}(); - virtual ~{{classname}}(); + {{classname}}() = default; + explicit {{classname}}(boost::property_tree::ptree const& pt); + virtual ~{{classname}}() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -46,17 +51,44 @@ public: {{{dataType}}} {{getter}}() const; void {{setter}}({{{dataType}}} value); {{/vars}} + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + protected: {{#vars}} + {{^isContainer}} + {{^isModel}} + {{{dataType}}} m_{{name}} = {{{defaultValue}}}; + {{/isModel}} + {{#isModel}} {{{dataType}}} m_{{name}}; + {{/isModel}} + {{/isContainer}} + {{#isContainer}} + {{{dataType}}} m_{{name}}; + {{/isContainer}} {{/vars}} {{#vars}} {{#isEnum}} - std::vector<{{{dataType}}}> m_{{enumName}}; + const std::array m_{{enumName}} = { + {{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + }; + {{/isEnum}} {{/vars}} }; +std::vector<{{classname}}> create{{classname}}VectorFromJsonString(const std::string& json); + {{#modelNamespaceDeclarations}} } {{/modelNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-source.mustache index 9d56632b7fb..395e415c6b4 100644 --- a/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-restbed-server/model-source.mustache @@ -4,6 +4,7 @@ #include "{{classname}}.h" #include +#include #include #include {{#hasEnums}} @@ -20,43 +21,39 @@ using boost::property_tree::write_json; namespace {{this}} { {{/modelNamespaceDeclarations}} -{{classname}}::{{classname}}() +{{classname}}::{{classname}}(boost::property_tree::ptree const& pt) { - {{#vars}} - {{^isContainer}} - {{#isPrimitiveType}} - m_{{name}} = {{{defaultValue}}}; - {{/isPrimitiveType}} - {{^isPrimitiveType}} - {{#isString}} - m_{{name}} = {{{defaultValue}}}; - {{/isString}} - {{#isDate}} - m_{{name}} = {{{defaultValue}}}; - {{/isDate}} - {{#isDateTime}} - m_{{name}} = {{{defaultValue}}}; - {{/isDateTime}} - {{#isEnum}} - m_{{enumName}} = { {{#allowableValues}}{{#enumVars}}{{^-first}}, {{/-first}}{{{value}}}{{/enumVars}}{{/allowableValues}} }; - {{/isEnum}} - {{/isPrimitiveType}} - {{/isContainer}} - {{/vars}} + fromPropertyTree(pt); } -{{classname}}::~{{classname}}() +std::string {{classname}}::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string {{classname}}::toJsonString(bool prettyJson) +void {{classname}}::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree {{classname}}::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void {{classname}}::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string {{classname}}::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void {{classname}}::fromJsonString(std::string const& jsonString) +void {{classname}}::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -64,7 +61,7 @@ void {{classname}}::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree {{classname}}::toPropertyTree() +ptree {{classname}}::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -91,34 +88,29 @@ ptree {{classname}}::toPropertyTree() {{/isPrimitiveType}} {{/isContainer}} {{#isContainer}} - {{^isModelContainer}} // generate tree for {{name}} if (!m_{{name}}.empty()) { for (const auto &childEntry : m_{{name}}) { - ptree {{name}}_node; - {{name}}_node.put("", childEntry); - tmp_node.push_back(std::make_pair("", {{name}}_node)); + {{#items}} + {{#isModel}} + tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree())); + {{/isModel}} + {{^isModel}} + ptree {{name}}_node; + {{name}}_node.put("", childEntry); + tmp_node.push_back(std::make_pair("", {{name}}_node)); + {{/isModel}} + {{/items}} } pt.add_child("{{baseName}}", tmp_node); tmp_node.clear(); } - {{/isModelContainer}} - {{#isModelContainer}} - // generate tree for vector of pointers of {{name}} - if (!m_{{name}}.empty()) { - for (const auto &childEntry : m_{{name}}) { - tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree())); - } - pt.add_child("{{baseName}}", tmp_node); - tmp_node.clear(); - } - {{/isModelContainer}} {{/isContainer}} {{/vars}} return pt; } -void {{classname}}::fromPropertyTree(ptree const &pt) +void {{classname}}::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; {{#vars}} @@ -154,9 +146,37 @@ void {{classname}}::fromPropertyTree(ptree const &pt) // push all items of {{name}} into member vector if (pt.get_child_optional("{{baseName}}")) { for (const auto &childTree : pt.get_child("{{baseName}}")) { - {{#mostInnerItems}} - m_{{name}}.emplace_back({{#isNumeric}}{{^isFloat}}{{^isLong}}{{^isInteger}}std::stod{{/isInteger}}{{/isLong}}{{/isFloat}}{{#isDouble}}std::stod{{/isDouble}}{{#isFloat}}std::stof{{/isFloat}}{{#isInteger}}std::stoi{{/isInteger}}{{#isLong}}std::stol{{/isLong}}({{/isNumeric}}childTree.second.data()){{#isNumeric}}){{/isNumeric}}; - {{/mostInnerItems}} + {{#mostInnerItems}} + {{{dataType}}} val = + {{#isNumeric}} + {{^isFloat}} + {{^isLong}} + {{^isInteger}} + std::stod(childTree.second.data()); + {{/isInteger}} + {{/isLong}} + {{/isFloat}} + {{#isDouble}} + std::stod(childTree.second.data()); + {{/isDouble}} + {{#isFloat}} + std::stof(childTree.second.data()); + {{/isFloat}} + {{#isInteger}} + std::stoi(childTree.second.data()); + {{/isInteger}} + {{#isLong}} + std::stol(childTree.second.data()); + {{/isLong}} + {{/isNumeric}} + {{#isString}} + childTree.second.data(); + {{/isString}} + {{#isModel}} + std::make_shared<{{baseType}}>(childTree.second); + {{/isModel}} + m_{{name}}.emplace_back(std::move(val)); + {{/mostInnerItems}} } } {{/isModelContainer}} @@ -180,6 +200,7 @@ void {{classname}}::fromPropertyTree(ptree const &pt) { return m_{{name}}; } + void {{classname}}::{{setter}}({{{dataType}}} value) { {{#isEnum}}if (std::find(m_{{enumName}}.begin(), m_{{enumName}}.end(), value) != m_{{enumName}}.end()) { @@ -190,6 +211,20 @@ void {{classname}}::{{setter}}({{{dataType}}} value) } {{/vars}} +std::vector<{{classname}}> create{{classname}}VectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector<{{{classname}}}>(); + for (const auto& child: pt) { + vec.emplace_back({{{classname}}}(child.second)); + } + + return vec; +} + {{#modelNamespaceDeclarations}} } {{/modelNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/crystal/api_client_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/crystal/api_client_faraday_partial.mustache deleted file mode 100644 index d1782b5e348..00000000000 --- a/modules/openapi-generator/src/main/resources/crystal/api_client_faraday_partial.mustache +++ /dev/null @@ -1,138 +0,0 @@ - # Call an API with given options. - # - # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: - # the data deserialized from response body (could be nil), response status code and response headers. - def call_api(http_method, path, opts = {} of Symbol => String) - ssl_options = { - :ca_file => @config.ssl_ca_file, - :verify => @config.ssl_verify, - :verify_mode => @config.ssl_verify_mode, - :client_cert => @config.ssl_client_cert, - :client_key => @config.ssl_client_key - } - - connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| - conn.basic_auth(config.username, config.password) - if opts[:header_params]["Content-Type"] == "multipart/form-data" - conn.request :multipart - conn.request :url_encoded - end - conn.adapter(Faraday.default_adapter) - end - - begin - response = connection.public_send(http_method.to_sym.downcase) do |req| - build_request(http_method, path, req, opts) - end - - if @config.debugging - Log.debug {"HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"} - end - - unless response.success? - if response.status == 0 - # Errors from libcurl will be made visible here - fail ApiError.new(code: 0, - message: response.return_message) - else - fail ApiError.new(code: response.status, - response_headers: response.headers, - response_body: response.body), - response.reason_phrase - end - end - rescue Faraday::TimeoutError - fail ApiError.new("Connection timed out") - end - - if opts[:return_type] - data = deserialize(response, opts[:return_type]) - else - data = nil - end - return data, response.status, response.headers - end - - # Builds the HTTP request - # - # @param [String] http_method HTTP method/verb (e.g. POST) - # @param [String] path URL path (e.g. /account/new) - # @option opts [Hash] :header_params Header parameters - # @option opts [Hash] :query_params Query parameters - # @option opts [Hash] :form_params Query parameters - # @option opts [Object] :body HTTP body (JSON/XML) - # @return [Typhoeus::Request] A Typhoeus Request - def build_request(http_method, path, request, opts = {} of Symbol => String) - url = build_request_url(path, opts) - http_method = http_method.to_sym.downcase - - header_params = @default_headers.merge(opts[:header_params] || {} of Symbole => String) - query_params = opts[:query_params] || {} of Symbol => String - form_params = opts[:form_params] || {} of Symbol => String - - update_params_for_auth! header_params, query_params, opts[:auth_names] - - req_opts = { - :method => http_method, - :headers => header_params, - :params => query_params, - :params_encoding => @config.params_encoding, - :timeout => @config.timeout, - :verbose => @config.debugging - } - - if [:post, :patch, :put, :delete].includes?(http_method) - req_body = build_request_body(header_params, form_params, opts[:body]) - req_opts.update body: req_body - if @config.debugging - Log.debug {"HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"} - end - end - request.headers = header_params - request.body = req_body - request.url url - request.params = query_params - download_file(request) if opts[:return_type] == "File" - request - end - - # Builds the HTTP request body - # - # @param [Hash] header_params Header parameters - # @param [Hash] form_params Query parameters - # @param [Object] body HTTP body (JSON/XML) - # @return [String] HTTP body data in the form of string - def build_request_body(header_params, form_params, body) - # http form - if header_params["Content-Type"] == "application/x-www-form-urlencoded" - data = URI.encode_www_form(form_params) - elsif header_params["Content-Type"] == "multipart/form-data" - data = {} of Symbol => String - form_params.each do |key, value| - case value - when ::File, ::Tempfile - # TODO hardcode to application/octet-stream, need better way to detect content type - data[key] = Faraday::UploadIO.new(value.path, "application/octet-stream", value.path) - when ::Array, nil - # let Faraday handle Array and nil parameters - data[key] = value - else - data[key] = value.to_s - end - end - elsif body - data = body.is_a?(String) ? body : body.to_json - else - data = nil - end - data - end - - def download_file(request) - @stream = [] - - # handle streaming Responses - request.options.on_data = Proc.new do |chunk, overall_received_bytes| - @stream << chunk - end - end diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache index 0791bb57692..e7dfa174d9b 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache @@ -162,6 +162,7 @@ {{^isReadOnly}} {{^required}} {{#defaultValue}} + {{^conditionalSerialization}} {{^vendorExtensions.x-csharp-value-type}} // use default value if no "{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}" provided this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} ?? {{{defaultValue}}}; @@ -169,6 +170,7 @@ {{#vendorExtensions.x-csharp-value-type}} this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/vendorExtensions.x-csharp-value-type}} + {{/conditionalSerialization}} {{/defaultValue}} {{^defaultValue}} {{^conditionalSerialization}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache index f77c8b91506..11bc668b902 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache @@ -105,7 +105,13 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> { result.{{{name}}}.replace(valueDes); {{/isContainer}} {{#isModel}} + {{#isPrimitiveType}} + {{! These are models that have nee manually marked as primitve via generator param. }} + result.{{{name}}} = valueDes; + {{/isPrimitiveType}} + {{^isPrimitiveType}} result.{{{name}}}.replace(valueDes); + {{/isPrimitiveType}} {{/isModel}} {{^isContainer}} {{^isModel}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index c16db47c110..32f3ee2d8c4 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -197,33 +197,7 @@ class {{{classname}}} { {{/isMap}} {{^isMap}} return await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}',) as {{{returnType}}}; - {{/isMap}}{{/isArray}}{{/native_serialization}}{{#json_serializable}} - {{#isArray}} - {{#uniqueItems}} - return (json.decode(response.body) as List) - .map((i) => {{{returnBaseType}}}.fromJson(i)) - .toSet(); - {{/uniqueItems}} - {{^uniqueItems}} - return (json.decode(response.body) as List) - .map((i) => {{{returnBaseType}}}.fromJson(i)) - .toList(); - {{/uniqueItems}} - {{/isArray}} - {{^isArray}} - {{#isMap}} - return {{{returnType}}}.from(json.decode(response.body)); - {{/isMap}} - {{^isMap}} - {{#returnTypeIsPrimitive}} - return response.body as {{{returnBaseType}}}; - {{/returnTypeIsPrimitive}} - {{^returnTypeIsPrimitive}} - return {{{returnType}}}.fromJson(json.decode(response.body)); - {{/returnTypeIsPrimitive}} - {{/isMap}} - {{/isArray}} - {{/json_serializable}} + {{/isMap}}{{/isArray}}{{/native_serialization}} } return Future<{{{returnType}}}>.value(); {{/returnType}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index 85be6bc9376..7eb14870b7c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -208,7 +208,6 @@ class ApiClient { case '{{{classname}}}': {{#isEnum}} {{#native_serialization}}return {{{classname}}}TypeTransformer().decode(value);{{/native_serialization}} - {{#json_serializable}} return _$enumDecode(_${{{classname}}}EnumMap, value);{{/json_serializable}} {{/isEnum}} {{^isEnum}} return {{{classname}}}.fromJson(value); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache index c64effcdda0..6b2f4f2fdef 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -54,7 +54,7 @@ String parameterToString(dynamic value) { {{#model}} {{#isEnum}} if (value is {{{classname}}}) { -{{#native_serialization}} return {{{classname}}}TypeTransformer().encode(value).toString();{{/native_serialization}}{{#json_serializable}} return value.toString();{{/json_serializable}} +{{#native_serialization}} return {{{classname}}}TypeTransformer().encode(value).toString();{{/native_serialization}} } {{/isEnum}} {{/model}} diff --git a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache index e2233d95ec4..2fcebda4ea4 100644 --- a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache @@ -7,9 +7,6 @@ import 'dart:io'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; -{{#json_serializable}} -import 'package:json_annotation/json_annotation.dart'; -{{/json_serializable}} import 'package:meta/meta.dart'; part 'api_client.dart'; @@ -26,9 +23,6 @@ part 'auth/http_bearer_auth.dart'; {{#models}}{{#model}}part 'model/{{{classFilename}}}.dart'; {{/model}}{{/models}} -{{#json_serializable}} -part 'api.g.dart'; -{{/json_serializable}} const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); diff --git a/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache b/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache deleted file mode 100644 index 89a4dd6e1c2..00000000000 --- a/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache +++ /dev/null @@ -1,18 +0,0 @@ -targets: - $default: - builders: - json_serializable: - options: - # Options configure how source code is generated for every - # `@JsonSerializable`-annotated class in the package. - # - # The default value for each is listed. - any_map: false - checked: true - create_factory: true - create_to_json: true - disallow_unrecognized_keys: true - explicit_to_json: true - field_rename: none - ignore_unannotated: false - include_if_null: false diff --git a/modules/openapi-generator/src/main/resources/dart2/model.mustache b/modules/openapi-generator/src/main/resources/dart2/model.mustache index 9c738da279b..306c54e417e 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model.mustache @@ -6,17 +6,11 @@ {{#native_serialization}} {{>serialization/native/native_enum}} {{/native_serialization}} -{{#json_serializable}} -{{>serialization/json_serializable/json_serializable_enum}} -{{/json_serializable}} {{/isEnum}} {{^isEnum}} {{#native_serialization}} {{>serialization/native/native_class}} {{/native_serialization}} -{{#json_serializable}} -{{>serialization/json_serializable/json_serializable_class}} -{{/json_serializable}} {{/isEnum}} {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache index 4ce12df9e48..18698623742 100644 --- a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache @@ -12,10 +12,5 @@ dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' meta: '^1.1.8' -{{#json_serializable}} - json_annotation: '^3.1.1'{{/json_serializable}} dev_dependencies: test: '>=1.16.0 <1.18.0' -{{#json_serializable}} - build_runner: '^1.10.9' - json_serializable: '^3.5.1'{{/json_serializable}} diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache deleted file mode 100644 index ec97f23eb72..00000000000 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_class.mustache +++ /dev/null @@ -1,67 +0,0 @@ -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class {{{classname}}} { -{{>dart_constructor}} - -{{#vars}} - {{#description}} - /// {{{.}}} - {{/description}} - {{^isEnum}} - {{#minimum}} - // minimum: {{{.}}} - {{/minimum}} - {{#maximum}} - // maximum: {{{.}}} - {{/maximum}} - {{/isEnum}} - {{^isBinary}} - @JsonKey( - {{#defaultValue}}defaultValue: {{{.}}},{{/defaultValue}}{{^defaultValue}}nullable: {{isNullable}},{{/defaultValue}} - name: r'{{{baseName}}}', - required: {{#required}}true{{/required}}{{^required}}false{{/required}}, - ) - {{/isBinary}} - {{#isBinary}} - @JsonKey(ignore: true) - {{/isBinary}} - {{{datatypeWithEnum}}} {{{name}}}; - -{{/vars}} - @override - bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && - {{#vars}} - other.{{{name}}} == {{{name}}}{{^-last}} &&{{/-last}}{{#-last}};{{/-last}} - {{/vars}} - - @override - int get hashCode => - {{#vars}} - ({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}} - {{/vars}} - - factory {{{classname}}}.fromJson(Map json) => _${{{classname}}}FromJson(json); - - Map toJson() => _${{{classname}}}ToJson(this); - - @override - String toString() => toJson().toString(); -} -{{#vars}} - {{#isEnum}} - {{^isContainer}} - -{{>serialization/json_serializable/json_serializable_enum_inline}} - {{/isContainer}} - {{#isContainer}} - {{#mostInnerItems}} - -{{>serialization/json_serializable/json_serializable_enum_inline}} - {{/mostInnerItems}} - {{/isContainer}} - {{/isEnum}} -{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum.mustache deleted file mode 100644 index 3fe458ab91f..00000000000 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum.mustache +++ /dev/null @@ -1,7 +0,0 @@ -enum {{{classname}}} { -{{#allowableValues}} -{{#enumVars}} - {{{name}}}, -{{/enumVars}} -{{/allowableValues}} -} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum_inline.mustache deleted file mode 100644 index 6e9f9016750..00000000000 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/json_serializable/json_serializable_enum_inline.mustache +++ /dev/null @@ -1,8 +0,0 @@ -{{#description}}/// {{{.}}}{{/description}} -enum {{{enumName}}} { -{{#allowableValues}} -{{#enumVars}} - {{{name}}}, -{{/enumVars}} -{{/allowableValues}} -} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/SpringBootApplication.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/SpringBootApplication.mustache index eb3200d8c04..dfaa576137d 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/SpringBootApplication.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/SpringBootApplication.mustache @@ -4,11 +4,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; {{#eurekaUri}} import org.springframework.cloud.netflix.eureka.EnableEurekaClient; {{/eurekaUri}} -import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** @@ -22,8 +20,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; {{#eurekaUri}} @EnableEurekaClient {{/eurekaUri}} -@EnableCircuitBreaker -@EnableHystrixDashboard public class {{serviceName}}Application { private static final Logger LOGGER = LoggerFactory.getLogger({{serviceName}}Application.class); diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache index 6339f166a70..33b2c6977d1 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache @@ -113,18 +113,11 @@ org.springframework.boot spring-boot-starter-jetty - - - org.springframework.cloud - spring-cloud-starter-hystrix-dashboard - org.springframework spring-jdbc diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-dev.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-dev.mustache index 0c39aa79252..e86b24447bf 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-dev.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-dev.mustache @@ -38,10 +38,6 @@ info: description: Microservice developed by PKMST version: {{artifactVersion}} -health: - hystrix: - enabled: true - security: basic: enabled: false diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-local.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-local.mustache index fc05837af20..5d0a8075b07 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-local.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/resources/application-local.mustache @@ -37,14 +37,11 @@ info: name: {{serviceName}} description: Microservice developed by PKMST version: {{artifactVersion}} - -health: - hystrix: - enabled: true - + security: basic: enabled: false + # provide rabbitmq configuration spring: rabbitmq: diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache index ef6c5888ae1..26325424e5d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache @@ -7,7 +7,7 @@ class HttpBasicAuth : Authentication { var username: String? = null var password: String? = null - @InternalAPI + @OptIn(InternalAPI::class) override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache index 7a1e9c03d4f..0a5ecca3d6b 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache @@ -19,7 +19,7 @@ This server has been generated with [Laminas (Zend) PSR-7 implementation](https: ## Requirements * Web server with URL rewriting -* PHP 7.2 or newer +* PHP 7.3 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache index 78373208494..4375a02d56a 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache @@ -8,7 +8,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.3 || ^8.0", "slim/slim": "^4.5.0", "dyorg/slim-token-authentication": "dev-slim4", "ybelenko/openapi-data-mocker": "^1.0", diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache index 6921643f627..b3278a2920e 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache @@ -2,7 +2,7 @@ {{#appName}} * {{{.}}} {{/appName}} - * PHP version 7.2 + * PHP version 7.3 * * @package {{invokerPackage}} * @author OpenAPI Generator team diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache index c8e5d27ca2a..026da14ad2e 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache @@ -1,32 +1,22 @@ - - - - {{apiTestPath}} - - - ./{{testBasePath}}/BaseModelTest.php - {{modelTestPath}} - - - - - {{apiSrcPath}} - ./{{srcBasePath}}/BaseModel.php - {{modelSrcPath}} - - - - - + + + + {{apiSrcPath}} + ./{{srcBasePath}}/BaseModel.php + {{modelSrcPath}} + + + + + {{apiTestPath}} + + + ./{{testBasePath}}/BaseModelTest.php + {{modelTestPath}} + + + + + diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index b9704b153f4..2d5c2c91138 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -296,6 +296,9 @@ class ObjectSerializer if ($class === 'object') { settype($data, 'array'); return $data; + } else if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; } if ($class === '\DateTime') { diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 66934f56449..60989ca5739 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -21,6 +21,7 @@ namespace {{apiPackage}}; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -197,6 +198,13 @@ use {{invokerPackage}}\ObjectSerializer; $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -552,7 +560,7 @@ use {{invokerPackage}}\ObjectSerializer; $formParams['{{baseName}}'] = []; $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; foreach ($paramFiles as $paramFile) { - $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\try_fopen( + $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen( ObjectSerializer::toFormValue($paramFile), 'rb' ); @@ -607,7 +615,7 @@ use {{invokerPackage}}\ObjectSerializer; } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -660,7 +668,7 @@ use {{invokerPackage}}\ObjectSerializer; $operationHost = $operationHosts[$this->hostIndex]; {{/servers.0}} - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( '{{httpMethod}}', {{^servers.0}}$this->config->getHost(){{/servers.0}}{{#servers.0}}$operationHost{{/servers.0}} . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index e7d2f939ef2..6a69cead65d 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -28,7 +28,8 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2" + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^2.0" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache index 6d055d51001..a32b6ab6a8a 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache @@ -12,7 +12,7 @@ } connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| - conn.basic_auth(config.username, config.password) + conn.request(:basic_auth, config.username, config.password) @config.configure_middleware(conn) if opts[:header_params]["Content-Type"] == "multipart/form-data" conn.request :multipart diff --git a/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache index ded6202a35a..e2833f16ed9 100644 --- a/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/hyper/api.mustache @@ -34,7 +34,7 @@ pub trait {{{classname}}} { impl{{{classname}}} for {{{classname}}}Client { {{#operations}} {{#operation}} - fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Box>> { + fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{^isUuid}}&str{{/isUuid}}{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Box>> { let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string()) {{#hasAuthMethods}} {{#authMethods}} diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index 0e13e0ab8cc..867ba22a254 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -90,7 +90,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}} -pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}{{#isBodyParam}}crate::models::{{/isBodyParam}}{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> { +pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}{{#isBodyParam}}crate::models::{{/isBodyParam}}{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> { let local_var_configuration = configuration; {{/vendorExtensions.x-group-parameters}} diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache index a82135170c4..f9dd5c19b87 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache @@ -172,7 +172,7 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomC case Some(c: String) => HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(c))) case _ => - HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(" "))) + HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(""))) } case m: HttpMethod => HttpRequest(m, uri) } diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index 2ff5a17bb29..02c52d23355 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -178,7 +178,7 @@ export class {{classname}} { {{/required}} {{/allParams}} -{{#hasQueryParams}} +{{#hasQueryParamsOrAuth}} let localVarQueryParameters = new HttpParams({encoder: this.encoder}); {{#queryParams}} {{#isArray}} @@ -209,7 +209,7 @@ export class {{classname}} { {{/isArray}} {{/queryParams}} -{{/hasQueryParams}} +{{/hasQueryParamsOrAuth}} let localVarHeaders = this.defaultHeaders; {{#headerParams}} {{#isArray}} @@ -359,9 +359,9 @@ export class {{classname}} { {{#httpContextInOptions}} context: localVarHttpContext, {{/httpContextInOptions}} - {{#hasQueryParams}} + {{#hasQueryParamsOrAuth}} params: localVarQueryParameters, - {{/hasQueryParams}} + {{/hasQueryParamsOrAuth}} {{#isResponseFile}} responseType: "blob", {{/isResponseFile}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharp/CSharpOperationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharp/CSharpOperationTest.java index 16ca55fac4c..175446c9a94 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharp/CSharpOperationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharp/CSharpOperationTest.java @@ -15,49 +15,18 @@ * limitations under the License. */ -package org.openapitools.codegen; +package org.openapitools.codegen.csharp; -import com.google.common.collect.Sets; -import com.samskivert.mustache.Mustache.Lambda; - -import io.swagger.parser.OpenAPIParser; -import io.swagger.v3.oas.models.Components; 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.headers.Header; -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.parameters.QueryParameter; -import io.swagger.v3.oas.models.parameters.RequestBody; -import io.swagger.v3.oas.models.responses.ApiResponse; -import io.swagger.v3.oas.models.responses.ApiResponses; -import io.swagger.v3.oas.models.security.SecurityScheme; -import io.swagger.v3.parser.core.models.ParseOptions; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.config.CodegenConfigurator; -import org.openapitools.codegen.config.GlobalSettings; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.languages.AbstractCSharpCodegen; import org.openapitools.codegen.languages.AspNetCoreServerCodegen; import org.openapitools.codegen.languages.CSharpNetCoreClientCodegen; -import org.openapitools.codegen.templating.mustache.CamelCaseLambda; -import org.openapitools.codegen.templating.mustache.IndentedLambda; -import org.openapitools.codegen.templating.mustache.LowercaseLambda; -import org.openapitools.codegen.templating.mustache.TitlecaseLambda; -import org.openapitools.codegen.templating.mustache.UppercaseLambda; -import org.openapitools.codegen.utils.ModelUtils; -import org.openapitools.codegen.utils.SemVer; -import org.testng.Assert; import org.testng.annotations.Test; -import java.io.File; -import java.nio.file.Files; -import java.util.*; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import javax.accessibility.AccessibleAttributeSequence; - import static org.testng.Assert.*; public class CSharpOperationTest { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java index 720143ee5c0..1a27e46dbf2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java @@ -16,6 +16,7 @@ import org.testng.Assert; import org.testng.annotations.Test; import java.io.File; +import java.util.Collections; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @@ -250,4 +251,25 @@ public class AbstractKotlinCodegenTest { new String[] {"b", "d"} ); } + + @Test(description = "Issue #10591") + public void testEnumPropertyWithDefaultValue() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue10591-enum-defaultValue.yaml"); + final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen(); + + Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault"); + CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1); + + // Make sure we got the container object. + Assert.assertEquals(cm1.getDataType(), "kotlin.Any"); + Assert.assertEquals(codegen.getTypeDeclaration("MyResponse"), "MyResponse"); + + // We need to postProcess the model for enums to be processed + codegen.postProcessModels(Collections.singletonMap("models", Collections.singletonList(Collections.singletonMap("model", cm1)))); + + // Assert the enum default value is properly generated + CodegenProperty cp1 = cm1.vars.get(0); + Assert.assertEquals(cp1.getEnumName(), "PropertyName"); + Assert.assertEquals(cp1.getDefaultValue(), "PropertyName.vALUE"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/issue10591-enum-defaultValue.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue10591-enum-defaultValue.yaml new file mode 100644 index 00000000000..73b3547c2e2 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue10591-enum-defaultValue.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + title: 'Issue 10591 Enum default value' + version: latest +paths: + '/': + get: + operationId: operation + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ModelWithEnumPropertyHavingDefault' +components: + schemas: + ModelWithEnumPropertyHavingDefault: + required: + - propertyName + properties: + propertyName: + type: string + default: VALUE + enum: + - VALUE diff --git a/pom.xml b/pom.xml index 40563b5696f..7b209200c60 100644 --- a/pom.xml +++ b/pom.xml @@ -88,17 +88,17 @@ org.jvnet.wagon-svn wagon-svn - 1.8 + ${wagon-svn.version} org.apache.maven.wagon wagon-ssh-external - 1.0-alpha-6 + ${wagon-ssh-external.version} org.apache.maven.wagon wagon-webdav - 1.0-beta-1 + ${wagon-webdav.version} install @@ -124,56 +124,6 @@ - - net.revelc.code - formatter-maven-plugin - - - - 1.8 - 1.8 - 1.8 - LF - - - org.jacoco @@ -223,7 +173,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire-version} + ${maven-surefire-plugin.version} true 120 @@ -266,16 +216,16 @@ maven-compiler-plugin - 3.8.1 + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.source} org.apache.maven.plugins maven-jar-plugin - 3.2.0 + ${maven-jar-plugin.version} @@ -290,20 +240,20 @@ org.apache.maven.plugins maven-site-plugin - 3.7.1 + ${maven-site-plugin.version} org.apache.maven.plugins maven-release-plugin - 2.5.3 + ${maven-release-plugin.version} org.apache.maven.plugins maven-javadoc-plugin - 3.1.0 + ${maven-javadoc-plugin.version} - 1.8 + ${maven.compiler.source} UTF-8 1g true @@ -395,7 +345,7 @@ se.bjurr.violations violations-maven-plugin - ${violations-maven.plugin.version} + ${violations-maven-plugin.version} 0 VERBOSE @@ -430,20 +380,15 @@ - - net.revelc.code - formatter-maven-plugin - 0.5.2 - com.github.spotbugs spotbugs-maven-plugin - ${spotbugs.plugin.version} + ${spotbugs-plugin.version} org.apache.maven.plugins maven-pmd-plugin - ${pmd.plugin.version} + ${pmd-plugin.version} org.apache.maven.plugins @@ -453,7 +398,7 @@ pl.project13.maven git-commit-id-plugin - ${git.commit.id.plugin.version} + ${git-commit-id-plugin.version} @@ -532,7 +477,7 @@ com.github.spotbugs spotbugs-maven-plugin - ${spotbugs.plugin.version} + ${spotbugs-plugin.version} false @@ -552,7 +497,7 @@ org.apache.maven.plugins maven-pmd-plugin - ${pmd.plugin.version} + ${pmd-plugin.version} ${project.build.sourceEncoding} false @@ -581,7 +526,7 @@ com.github.spotbugs spotbugs-maven-plugin - ${spotbugs.plugin.version} + ${spotbugs-plugin.version} @@ -1140,18 +1085,6 @@ samples/server/petstore/springboot-virtualan - - spring-cloud - - - env - java - - - - samples/client/petstore/spring-cloud - - scalatra-server @@ -1468,7 +1401,6 @@ samples/openapi3/client/petstore/dart2/petstore_client_lib samples/openapi3/client/petstore/dart2/petstore - samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake @@ -1555,7 +1487,7 @@ net.alchim31.maven scala-maven-plugin - ${scala-maven-plugin-version} + ${scala-maven-plugin.version} org.apache.maven.plugins @@ -1568,7 +1500,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.0.0 + ${maven-project-info-reports-plugin.version} @@ -1584,13 +1516,13 @@ junit junit - ${junit-version} + ${junit.version} test org.testng testng - ${testng-version} + ${testng.version} test @@ -1607,29 +1539,44 @@ 1.8 1.8 - 2.1.2 - io.swagger.parser.v3 - 2.0.26 - 3.3.1 - 2.4 - 1.2 - 4.13 - 2.10.2 - 1.0.0 - 3.4 - 1.7.29 - 4.3.1 - 1.14 - 4.2.1 - 7.1.0 - 3.0.0-M5 - 0.9.10 - 3.6.28 - 0.8.5 - 3.1.12.2 - 3.12.0 - 1.34 + 3.1.0 - 4.0.0 + 1.4 + 2.11.0 + 3.12.0 + 1.3.0 + 1.0.2 + 4.9.10 + 3.0.9 + 30.1.1-jre + 4.2.1 + 2.10.0 + 2.10.2 + 0.8.7 + 1.14 + 4.13.2 + 1.3.60 + 3.8.1 + 3.2.0 + 3.1.1 + 3.0.0 + 2.5.3 + 3.7.1 + 3.12.4 + 3.12.0 + 0.10 + 1.3 + 4.3.1 + 1.7.32 + 3.1.12.2 + 3.0.0-M5 + 2.1.2 + io.swagger.parser.v3 + 2.0.26 + 7.4.0 + 1.34 + 3.4.3 + 1.12 + 1.0-beta-2 diff --git a/samples/client/petstore/cpp-qt/README.md b/samples/client/petstore/cpp-qt/README.md index c73e0f1e68e..9bb1fbd58b1 100644 --- a/samples/client/petstore/cpp-qt/README.md +++ b/samples/client/petstore/cpp-qt/README.md @@ -1,3 +1,5 @@ +# C++ Qt API client + # OpenAPI Petstore @@ -9,55 +11,18 @@ This is a sample server Petstore server. For this sample, you can use the api ke *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* -## Licence - -Apache-2.0 - -for more information visit [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html) ## Requirements Building the API client library requires: -1. Java 1.7+ -2. Maven/Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Generate manually - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Use the Jar file to generate the Qt Client: - -```shell -java -jar target/openapi-generator-cli.jar generate -i -g cpp-qt-client -o -``` +1. CMake 3.2+ +2. Qt +3. C++ Compiler ## Getting Started -Please follow the [installation](#installation) instruction and execute the following Java code: - example.h: - ```c++ #include @@ -73,8 +38,8 @@ public slots: }; ``` -example.cpp: +example.cpp: ```c++ #include "../client/PFXPetApi.h" @@ -109,49 +74,11 @@ void Example::exampleFunction1(){ ``` -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*PFXPetApi* | [**addPet**](PFXPetApi.md#addPet) | **POST** /pet | Add a new pet to the store -*PFXPetApi* | [**deletePet**](PFXPetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PFXPetApi* | [**findPetsByStatus**](PFXPetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -*PFXPetApi* | [**findPetsByTags**](PFXPetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -*PFXPetApi* | [**getPetById**](PFXPetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -*PFXPetApi* | [**updatePet**](PFXPetApi.md#updatePet) | **PUT** /pet | Update an existing pet -*PFXPetApi* | [**updatePetWithForm**](PFXPetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PFXPetApi* | [**uploadFile**](PFXPetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image -*PFXStoreApi* | [**deleteOrder**](PFXStoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*PFXStoreApi* | [**getInventory**](PFXStoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -*PFXStoreApi* | [**getOrderById**](PFXStoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID -*PFXStoreApi* | [**placeOrder**](PFXStoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet -*PFXUserApi* | [**createUser**](PFXUserApi.md#createUser) | **POST** /user | Create user -*PFXUserApi* | [**createUsersWithArrayInput**](PFXUserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -*PFXUserApi* | [**createUsersWithListInput**](PFXUserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -*PFXUserApi* | [**deleteUser**](PFXUserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -*PFXUserApi* | [**getUserByName**](PFXUserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -*PFXUserApi* | [**loginUser**](PFXUserApi.md#loginUser) | **GET** /user/login | Logs user into the system -*PFXUserApi* | [**logoutUser**](PFXUserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -*PFXUserApi* | [**updateUser**](PFXUserApi.md#updateUser) | **PUT** /user/{username} | Updated user - - -## Documentation for Models - - - [PFXApiResponse](PFXApiResponse.md) - - [PFXCategory](PFXCategory.md) - - [PFXOrder](PFXOrder.md) - - [PFXPet](PFXPet.md) - - [PFXTag](PFXTag.md) - - [PFXUser](PFXUser.md) - - ## Documentation for Servers Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables: -``` +```yaml servers: - url: http://{server}:{port}/{basePath} description: Description of the Server @@ -171,20 +98,20 @@ servers: default: v1 ``` To change the default variable, use this function in each Api: -``` - int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); +```c++ +int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); ``` The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid. Variable is the name of the variable you wish to change and the value is the new default Value. The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found. If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function: -``` - void setServerIndex(const QString &operation, int serverIndex); +```c++ +void setServerIndex(const QString &operation, int serverIndex); ``` Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index. Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1. -``` +```yaml servers: - url: http://{server}:8080/ description: Description of the Server @@ -198,7 +125,6 @@ servers: - url: https://localhost:8080/v1 ``` - ## Documentation for Authorization Authentication schemes defined for the API: @@ -224,3 +150,7 @@ Authentication schemes defined for the API: + +## License + +Apache-2.0 for more information visit [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html) \ No newline at end of file diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp index 9ec1a3c1291..40020aad88d 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp @@ -90,6 +90,13 @@ utility::string_t ApiClient::parameterToString(const utility::datetime &value) return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601)); } +utility::string_t ApiClient::parameterToString(bool value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << std::boolalpha << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} + pplx::task ApiClient::callApi( const utility::string_t& path, const utility::string_t& method, diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.h b/samples/client/petstore/cpp-restsdk/client/ApiClient.h index a6f0ad08b3a..7a86ca47bc0 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.h @@ -62,6 +62,7 @@ public: static utility::string_t parameterToString(float value); static utility::string_t parameterToString(double value); static utility::string_t parameterToString(const utility::datetime &value); + static utility::string_t parameterToString(bool value); template static utility::string_t parameterToString(const std::vector& value); template diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp index 240b8ca1682..d6d3e19245e 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp @@ -47,15 +47,15 @@ web::json::value ApiResponse::toJson() const if(m_CodeIsSet) { - val[utility::conversions::to_string_t("code")] = ModelBase::toJson(m_Code); + val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code); } if(m_TypeIsSet) { - val[utility::conversions::to_string_t("type")] = ModelBase::toJson(m_Type); + val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); } if(m_MessageIsSet) { - val[utility::conversions::to_string_t("message")] = ModelBase::toJson(m_Message); + val[utility::conversions::to_string_t(U("message"))] = ModelBase::toJson(m_Message); } return val; @@ -65,9 +65,9 @@ bool ApiResponse::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("code"))) + if(val.has_field(utility::conversions::to_string_t(U("code")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("code")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code"))); if(!fieldValue.is_null()) { int32_t refVal_code; @@ -75,9 +75,9 @@ bool ApiResponse::fromJson(const web::json::value& val) setCode(refVal_code); } } - if(val.has_field(utility::conversions::to_string_t("type"))) + if(val.has_field(utility::conversions::to_string_t(U("type")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("type")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); if(!fieldValue.is_null()) { utility::string_t refVal_type; @@ -85,9 +85,9 @@ bool ApiResponse::fromJson(const web::json::value& val) setType(refVal_type); } } - if(val.has_field(utility::conversions::to_string_t("message"))) + if(val.has_field(utility::conversions::to_string_t(U("message")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("message")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("message"))); if(!fieldValue.is_null()) { utility::string_t refVal_message; @@ -101,21 +101,21 @@ bool ApiResponse::fromJson(const web::json::value& val) void ApiResponse::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_CodeIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("code"), m_Code)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code)); } if(m_TypeIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("type"), m_Type)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); } if(m_MessageIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("message"), m_Message)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("message")), m_Message)); } } @@ -123,27 +123,27 @@ bool ApiResponse::fromMultiPart(std::shared_ptr multipart, co { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("code"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("code")))) { int32_t refVal_code; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("code")), refVal_code ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_code ); setCode(refVal_code); } - if(multipart->hasContent(utility::conversions::to_string_t("type"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) { utility::string_t refVal_type; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("type")), refVal_type ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_type ); setType(refVal_type); } - if(multipart->hasContent(utility::conversions::to_string_t("message"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("message")))) { utility::string_t refVal_message; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("message")), refVal_message ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_message ); setMessage(refVal_message); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp index 2cbfe4ed64d..640fc6a5e04 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp @@ -45,11 +45,11 @@ web::json::value Category::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } if(m_NameIsSet) { - val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } return val; @@ -59,9 +59,9 @@ bool Category::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("id"))) + if(val.has_field(utility::conversions::to_string_t(U("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); if(!fieldValue.is_null()) { int64_t refVal_id; @@ -69,9 +69,9 @@ bool Category::fromJson(const web::json::value& val) setId(refVal_id); } } - if(val.has_field(utility::conversions::to_string_t("name"))) + if(val.has_field(utility::conversions::to_string_t(U("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_name; @@ -85,17 +85,17 @@ bool Category::fromJson(const web::json::value& val) void Category::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); } } @@ -103,21 +103,21 @@ bool Category::fromMultiPart(std::shared_ptr multipart, const { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("id"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) { int64_t refVal_id; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id ); setId(refVal_id); } - if(multipart->hasContent(utility::conversions::to_string_t("name"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_name; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name ); setName(refVal_name); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp index 0533c250bd7..36c1a77e11a 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp @@ -53,27 +53,27 @@ web::json::value Order::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } if(m_PetIdIsSet) { - val[utility::conversions::to_string_t("petId")] = ModelBase::toJson(m_PetId); + val[utility::conversions::to_string_t(U("petId"))] = ModelBase::toJson(m_PetId); } if(m_QuantityIsSet) { - val[utility::conversions::to_string_t("quantity")] = ModelBase::toJson(m_Quantity); + val[utility::conversions::to_string_t(U("quantity"))] = ModelBase::toJson(m_Quantity); } if(m_ShipDateIsSet) { - val[utility::conversions::to_string_t("shipDate")] = ModelBase::toJson(m_ShipDate); + val[utility::conversions::to_string_t(U("shipDate"))] = ModelBase::toJson(m_ShipDate); } if(m_StatusIsSet) { - val[utility::conversions::to_string_t("status")] = ModelBase::toJson(m_Status); + val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status); } if(m_CompleteIsSet) { - val[utility::conversions::to_string_t("complete")] = ModelBase::toJson(m_Complete); + val[utility::conversions::to_string_t(U("complete"))] = ModelBase::toJson(m_Complete); } return val; @@ -83,9 +83,9 @@ bool Order::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("id"))) + if(val.has_field(utility::conversions::to_string_t(U("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); if(!fieldValue.is_null()) { int64_t refVal_id; @@ -93,9 +93,9 @@ bool Order::fromJson(const web::json::value& val) setId(refVal_id); } } - if(val.has_field(utility::conversions::to_string_t("petId"))) + if(val.has_field(utility::conversions::to_string_t(U("petId")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("petId")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("petId"))); if(!fieldValue.is_null()) { int64_t refVal_petId; @@ -103,9 +103,9 @@ bool Order::fromJson(const web::json::value& val) setPetId(refVal_petId); } } - if(val.has_field(utility::conversions::to_string_t("quantity"))) + if(val.has_field(utility::conversions::to_string_t(U("quantity")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("quantity")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("quantity"))); if(!fieldValue.is_null()) { int32_t refVal_quantity; @@ -113,9 +113,9 @@ bool Order::fromJson(const web::json::value& val) setQuantity(refVal_quantity); } } - if(val.has_field(utility::conversions::to_string_t("shipDate"))) + if(val.has_field(utility::conversions::to_string_t(U("shipDate")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("shipDate")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("shipDate"))); if(!fieldValue.is_null()) { utility::datetime refVal_shipDate; @@ -123,9 +123,9 @@ bool Order::fromJson(const web::json::value& val) setShipDate(refVal_shipDate); } } - if(val.has_field(utility::conversions::to_string_t("status"))) + if(val.has_field(utility::conversions::to_string_t(U("status")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status"))); if(!fieldValue.is_null()) { utility::string_t refVal_status; @@ -133,9 +133,9 @@ bool Order::fromJson(const web::json::value& val) setStatus(refVal_status); } } - if(val.has_field(utility::conversions::to_string_t("complete"))) + if(val.has_field(utility::conversions::to_string_t(U("complete")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("complete")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("complete"))); if(!fieldValue.is_null()) { bool refVal_complete; @@ -149,33 +149,33 @@ bool Order::fromJson(const web::json::value& val) void Order::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); } if(m_PetIdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("petId"), m_PetId)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("petId")), m_PetId)); } if(m_QuantityIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("quantity"), m_Quantity)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("quantity")), m_Quantity)); } if(m_ShipDateIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("shipDate"), m_ShipDate)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("shipDate")), m_ShipDate)); } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("status"), m_Status)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status)); } if(m_CompleteIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("complete"), m_Complete)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("complete")), m_Complete)); } } @@ -183,45 +183,45 @@ bool Order::fromMultiPart(std::shared_ptr multipart, const ut { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("id"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) { int64_t refVal_id; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id ); setId(refVal_id); } - if(multipart->hasContent(utility::conversions::to_string_t("petId"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("petId")))) { int64_t refVal_petId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("petId")), refVal_petId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_petId ); setPetId(refVal_petId); } - if(multipart->hasContent(utility::conversions::to_string_t("quantity"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("quantity")))) { int32_t refVal_quantity; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("quantity")), refVal_quantity ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_quantity ); setQuantity(refVal_quantity); } - if(multipart->hasContent(utility::conversions::to_string_t("shipDate"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("shipDate")))) { utility::datetime refVal_shipDate; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("shipDate")), refVal_shipDate ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_shipDate ); setShipDate(refVal_shipDate); } - if(multipart->hasContent(utility::conversions::to_string_t("status"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) { utility::string_t refVal_status; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("status")), refVal_status ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status ); setStatus(refVal_status); } - if(multipart->hasContent(utility::conversions::to_string_t("complete"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("complete")))) { bool refVal_complete; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("complete")), refVal_complete ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_complete ); setComplete(refVal_complete); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp index 8a52519bd6a..c7116e999ad 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp @@ -50,27 +50,27 @@ web::json::value Pet::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } if(m_CategoryIsSet) { - val[utility::conversions::to_string_t("category")] = ModelBase::toJson(m_Category); + val[utility::conversions::to_string_t(U("category"))] = ModelBase::toJson(m_Category); } if(m_NameIsSet) { - val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } if(m_PhotoUrlsIsSet) { - val[utility::conversions::to_string_t("photoUrls")] = ModelBase::toJson(m_PhotoUrls); + val[utility::conversions::to_string_t(U("photoUrls"))] = ModelBase::toJson(m_PhotoUrls); } if(m_TagsIsSet) { - val[utility::conversions::to_string_t("tags")] = ModelBase::toJson(m_Tags); + val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); } if(m_StatusIsSet) { - val[utility::conversions::to_string_t("status")] = ModelBase::toJson(m_Status); + val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status); } return val; @@ -80,9 +80,9 @@ bool Pet::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("id"))) + if(val.has_field(utility::conversions::to_string_t(U("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); if(!fieldValue.is_null()) { int64_t refVal_id; @@ -90,9 +90,9 @@ bool Pet::fromJson(const web::json::value& val) setId(refVal_id); } } - if(val.has_field(utility::conversions::to_string_t("category"))) + if(val.has_field(utility::conversions::to_string_t(U("category")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("category")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("category"))); if(!fieldValue.is_null()) { std::shared_ptr refVal_category; @@ -100,9 +100,9 @@ bool Pet::fromJson(const web::json::value& val) setCategory(refVal_category); } } - if(val.has_field(utility::conversions::to_string_t("name"))) + if(val.has_field(utility::conversions::to_string_t(U("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_name; @@ -110,9 +110,9 @@ bool Pet::fromJson(const web::json::value& val) setName(refVal_name); } } - if(val.has_field(utility::conversions::to_string_t("photoUrls"))) + if(val.has_field(utility::conversions::to_string_t(U("photoUrls")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("photoUrls")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photoUrls"))); if(!fieldValue.is_null()) { std::vector refVal_photoUrls; @@ -120,9 +120,9 @@ bool Pet::fromJson(const web::json::value& val) setPhotoUrls(refVal_photoUrls); } } - if(val.has_field(utility::conversions::to_string_t("tags"))) + if(val.has_field(utility::conversions::to_string_t(U("tags")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("tags")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags"))); if(!fieldValue.is_null()) { std::vector> refVal_tags; @@ -130,9 +130,9 @@ bool Pet::fromJson(const web::json::value& val) setTags(refVal_tags); } } - if(val.has_field(utility::conversions::to_string_t("status"))) + if(val.has_field(utility::conversions::to_string_t(U("status")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status"))); if(!fieldValue.is_null()) { utility::string_t refVal_status; @@ -146,33 +146,33 @@ bool Pet::fromJson(const web::json::value& val) void Pet::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); } if(m_CategoryIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("category"), m_Category)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("category")), m_Category)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); } if(m_PhotoUrlsIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("photoUrls"), m_PhotoUrls)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photoUrls")), m_PhotoUrls)); } if(m_TagsIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("tags"), m_Tags)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("status"), m_Status)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status)); } } @@ -180,45 +180,45 @@ bool Pet::fromMultiPart(std::shared_ptr multipart, const util { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("id"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) { int64_t refVal_id; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id ); setId(refVal_id); } - if(multipart->hasContent(utility::conversions::to_string_t("category"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("category")))) { std::shared_ptr refVal_category; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("category")), refVal_category ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_category ); setCategory(refVal_category); } - if(multipart->hasContent(utility::conversions::to_string_t("name"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_name; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name ); setName(refVal_name); } - if(multipart->hasContent(utility::conversions::to_string_t("photoUrls"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("photoUrls")))) { std::vector refVal_photoUrls; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("photoUrls")), refVal_photoUrls ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_photoUrls ); setPhotoUrls(refVal_photoUrls); } - if(multipart->hasContent(utility::conversions::to_string_t("tags"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) { std::vector> refVal_tags; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("tags")), refVal_tags ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_tags ); setTags(refVal_tags); } - if(multipart->hasContent(utility::conversions::to_string_t("status"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) { utility::string_t refVal_status; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("status")), refVal_status ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status ); setStatus(refVal_status); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp index f7cec46aa43..760c041b912 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp @@ -45,11 +45,11 @@ web::json::value Tag::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } if(m_NameIsSet) { - val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } return val; @@ -59,9 +59,9 @@ bool Tag::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("id"))) + if(val.has_field(utility::conversions::to_string_t(U("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); if(!fieldValue.is_null()) { int64_t refVal_id; @@ -69,9 +69,9 @@ bool Tag::fromJson(const web::json::value& val) setId(refVal_id); } } - if(val.has_field(utility::conversions::to_string_t("name"))) + if(val.has_field(utility::conversions::to_string_t(U("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_name; @@ -85,17 +85,17 @@ bool Tag::fromJson(const web::json::value& val) void Tag::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); } } @@ -103,21 +103,21 @@ bool Tag::fromMultiPart(std::shared_ptr multipart, const util { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("id"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) { int64_t refVal_id; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id ); setId(refVal_id); } - if(multipart->hasContent(utility::conversions::to_string_t("name"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_name; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name ); setName(refVal_name); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/model/User.cpp index d0981f41ccd..9b4fd9b0b6a 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/User.cpp @@ -57,35 +57,35 @@ web::json::value User::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } if(m_UsernameIsSet) { - val[utility::conversions::to_string_t("username")] = ModelBase::toJson(m_Username); + val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username); } if(m_FirstNameIsSet) { - val[utility::conversions::to_string_t("firstName")] = ModelBase::toJson(m_FirstName); + val[utility::conversions::to_string_t(U("firstName"))] = ModelBase::toJson(m_FirstName); } if(m_LastNameIsSet) { - val[utility::conversions::to_string_t("lastName")] = ModelBase::toJson(m_LastName); + val[utility::conversions::to_string_t(U("lastName"))] = ModelBase::toJson(m_LastName); } if(m_EmailIsSet) { - val[utility::conversions::to_string_t("email")] = ModelBase::toJson(m_Email); + val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email); } if(m_PasswordIsSet) { - val[utility::conversions::to_string_t("password")] = ModelBase::toJson(m_Password); + val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); } if(m_PhoneIsSet) { - val[utility::conversions::to_string_t("phone")] = ModelBase::toJson(m_Phone); + val[utility::conversions::to_string_t(U("phone"))] = ModelBase::toJson(m_Phone); } if(m_UserStatusIsSet) { - val[utility::conversions::to_string_t("userStatus")] = ModelBase::toJson(m_UserStatus); + val[utility::conversions::to_string_t(U("userStatus"))] = ModelBase::toJson(m_UserStatus); } return val; @@ -95,9 +95,9 @@ bool User::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t("id"))) + if(val.has_field(utility::conversions::to_string_t(U("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); if(!fieldValue.is_null()) { int64_t refVal_id; @@ -105,9 +105,9 @@ bool User::fromJson(const web::json::value& val) setId(refVal_id); } } - if(val.has_field(utility::conversions::to_string_t("username"))) + if(val.has_field(utility::conversions::to_string_t(U("username")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("username")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("username"))); if(!fieldValue.is_null()) { utility::string_t refVal_username; @@ -115,9 +115,9 @@ bool User::fromJson(const web::json::value& val) setUsername(refVal_username); } } - if(val.has_field(utility::conversions::to_string_t("firstName"))) + if(val.has_field(utility::conversions::to_string_t(U("firstName")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("firstName")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("firstName"))); if(!fieldValue.is_null()) { utility::string_t refVal_firstName; @@ -125,9 +125,9 @@ bool User::fromJson(const web::json::value& val) setFirstName(refVal_firstName); } } - if(val.has_field(utility::conversions::to_string_t("lastName"))) + if(val.has_field(utility::conversions::to_string_t(U("lastName")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("lastName")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("lastName"))); if(!fieldValue.is_null()) { utility::string_t refVal_lastName; @@ -135,9 +135,9 @@ bool User::fromJson(const web::json::value& val) setLastName(refVal_lastName); } } - if(val.has_field(utility::conversions::to_string_t("email"))) + if(val.has_field(utility::conversions::to_string_t(U("email")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("email")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("email"))); if(!fieldValue.is_null()) { utility::string_t refVal_email; @@ -145,9 +145,9 @@ bool User::fromJson(const web::json::value& val) setEmail(refVal_email); } } - if(val.has_field(utility::conversions::to_string_t("password"))) + if(val.has_field(utility::conversions::to_string_t(U("password")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("password")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); if(!fieldValue.is_null()) { utility::string_t refVal_password; @@ -155,9 +155,9 @@ bool User::fromJson(const web::json::value& val) setPassword(refVal_password); } } - if(val.has_field(utility::conversions::to_string_t("phone"))) + if(val.has_field(utility::conversions::to_string_t(U("phone")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("phone")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("phone"))); if(!fieldValue.is_null()) { utility::string_t refVal_phone; @@ -165,9 +165,9 @@ bool User::fromJson(const web::json::value& val) setPhone(refVal_phone); } } - if(val.has_field(utility::conversions::to_string_t("userStatus"))) + if(val.has_field(utility::conversions::to_string_t(U("userStatus")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("userStatus")); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("userStatus"))); if(!fieldValue.is_null()) { int32_t refVal_userStatus; @@ -181,41 +181,41 @@ bool User::fromJson(const web::json::value& val) void User::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); } if(m_UsernameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("username"), m_Username)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username)); } if(m_FirstNameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("firstName"), m_FirstName)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("firstName")), m_FirstName)); } if(m_LastNameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("lastName"), m_LastName)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("lastName")), m_LastName)); } if(m_EmailIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("email"), m_Email)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email)); } if(m_PasswordIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("password"), m_Password)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); } if(m_PhoneIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("phone"), m_Phone)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("phone")), m_Phone)); } if(m_UserStatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("userStatus"), m_UserStatus)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("userStatus")), m_UserStatus)); } } @@ -223,57 +223,57 @@ bool User::fromMultiPart(std::shared_ptr multipart, const uti { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) { - namePrefix += utility::conversions::to_string_t("."); + namePrefix += utility::conversions::to_string_t(U(".")); } - if(multipart->hasContent(utility::conversions::to_string_t("id"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) { int64_t refVal_id; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id ); setId(refVal_id); } - if(multipart->hasContent(utility::conversions::to_string_t("username"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("username")))) { utility::string_t refVal_username; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("username")), refVal_username ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("username"))), refVal_username ); setUsername(refVal_username); } - if(multipart->hasContent(utility::conversions::to_string_t("firstName"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("firstName")))) { utility::string_t refVal_firstName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("firstName")), refVal_firstName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("firstName"))), refVal_firstName ); setFirstName(refVal_firstName); } - if(multipart->hasContent(utility::conversions::to_string_t("lastName"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("lastName")))) { utility::string_t refVal_lastName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("lastName")), refVal_lastName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("lastName"))), refVal_lastName ); setLastName(refVal_lastName); } - if(multipart->hasContent(utility::conversions::to_string_t("email"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("email")))) { utility::string_t refVal_email; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("email")), refVal_email ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_email ); setEmail(refVal_email); } - if(multipart->hasContent(utility::conversions::to_string_t("password"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) { utility::string_t refVal_password; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("password")), refVal_password ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_password ); setPassword(refVal_password); } - if(multipart->hasContent(utility::conversions::to_string_t("phone"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("phone")))) { utility::string_t refVal_phone; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("phone")), refVal_phone ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("phone"))), refVal_phone ); setPhone(refVal_phone); } - if(multipart->hasContent(utility::conversions::to_string_t("userStatus"))) + if(multipart->hasContent(utility::conversions::to_string_t(U("userStatus")))) { int32_t refVal_userStatus; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("userStatus")), refVal_userStatus ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("userStatus"))), refVal_userStatus ); setUserStatus(refVal_userStatus); } return ok; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs index 3f38be822d8..b741cb66392 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Animal.cs @@ -56,8 +56,6 @@ namespace Org.OpenAPITools.Model throw new ArgumentNullException("className is a required property for Animal and cannot be null"); } this._ClassName = className; - // use default value if no "color" provided - this.Color = color ?? "red"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ChildCatAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ChildCatAllOf.cs index f38b5eb17a3..61ca1419437 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ChildCatAllOf.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/ChildCatAllOf.cs @@ -80,7 +80,6 @@ namespace Org.OpenAPITools.Model public ChildCatAllOf(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat) { this._Name = name; - this.PetType = petType; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs index 9aa3f0c364c..1e78c6575e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Foo.cs @@ -38,8 +38,6 @@ namespace Org.OpenAPITools.Model /// bar (default to "bar"). public Foo(string bar = "bar") { - // use default value if no "bar" provided - this.Bar = bar ?? "bar"; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Order.cs index 72eda939a4c..22b3dd19d6c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Order.cs @@ -102,7 +102,6 @@ namespace Org.OpenAPITools.Model this._Quantity = quantity; this._ShipDate = shipDate; this._Status = status; - this.Complete = complete; this.AdditionalProperties = new Dictionary(); } diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index e02a1831a5a..0b6925ac759 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-apache-httpclient:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-apache-httpclient' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-apache-httpclient' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-apache-httpclient:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/apache-httpclient/build.gradle b/samples/client/petstore/java/apache-httpclient/build.gradle index fee361a3cbe..6352fc775c2 100644 --- a/samples/client/petstore/java/apache-httpclient/build.gradle +++ b/samples/client/petstore/java/apache-httpclient/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -78,14 +76,18 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-apache-httpclient' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-apache-httpclient' + + from components.java + } } } diff --git a/samples/client/petstore/java/apache-httpclient/gradle.properties b/samples/client/petstore/java/apache-httpclient/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/apache-httpclient/gradle.properties +++ b/samples/client/petstore/java/apache-httpclient/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/apache-httpclient/gradlew b/samples/client/petstore/java/apache-httpclient/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/apache-httpclient/gradlew +++ b/samples/client/petstore/java/apache-httpclient/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/apache-httpclient/gradlew.bat b/samples/client/petstore/java/apache-httpclient/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/apache-httpclient/gradlew.bat +++ b/samples/client/petstore/java/apache-httpclient/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES index b26b7d34306..e228aa901f2 100644 --- a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES @@ -14,6 +14,7 @@ pom.xml settings.gradle src/main/AndroidManifest.xml src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiResponseDecoder.java src/main/java/org/openapitools/client/CustomInstantDeserializer.java src/main/java/org/openapitools/client/EncodingUtils.java src/main/java/org/openapitools/client/ParamExpander.java @@ -45,6 +46,7 @@ src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/ApiResponse.java src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayTest.java diff --git a/samples/client/petstore/java/feign-no-nullable/gradle.properties b/samples/client/petstore/java/feign-no-nullable/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/feign-no-nullable/gradle.properties +++ b/samples/client/petstore/java/feign-no-nullable/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/feign-no-nullable/gradlew b/samples/client/petstore/java/feign-no-nullable/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/feign-no-nullable/gradlew +++ b/samples/client/petstore/java/feign-no-nullable/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/feign-no-nullable/gradlew.bat b/samples/client/petstore/java/feign-no-nullable/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/feign-no-nullable/gradlew.bat +++ b/samples/client/petstore/java/feign-no-nullable/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 19d32c4e314..ba2274d8fe0 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -22,6 +22,7 @@ import feign.slf4j.Slf4jLogger; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.ApiResponseDecoder; import org.openapitools.client.auth.ApiErrorDecoder; import org.openapitools.client.auth.OAuth; @@ -48,7 +49,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new ApiResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiResponseDecoder.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiResponseDecoder.java new file mode 100644 index 00000000000..d74d1d8768d --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiResponseDecoder.java @@ -0,0 +1,38 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import org.openapitools.client.model.ApiResponse; + +public class ApiResponseDecoder extends JacksonDecoder { + + public ApiResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class ApiResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new ApiResponse(response.status(), responseHeaders, body); + } else { + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java new file mode 100644 index 00000000000..b3db8c605ab --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java @@ -0,0 +1,38 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import org.openapitools.client.model.HttpResponse; + +public class JacksonResponseDecoder extends JacksonDecoder { + + public JacksonResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class HttpResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) { + //The HttpResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new HttpResponse(responseHeaders, body, response.status()); + } else { + //The response is not encapsulated in the HttpResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 2cefc6e4185..db3647bf64d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Client; @@ -27,4 +28,20 @@ public interface AnotherFakeApi extends ApiClient.Api { "Accept: application/json", }) Client call123testSpecialTags(Client body); + + /** + * To test special tags + * Similar to call123testSpecialTags but it also returns the http response headers . + * To test special tags and operation ID starting with number + * @param body client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /another-fake/dummy") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse call123testSpecialTagsWithHttpInfo(Client body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java index 9029ef9ffe7..3a9fb59c458 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; @@ -35,6 +36,21 @@ public interface FakeApi extends ApiClient.Api { }) void createXmlItem(XmlItem xmlItem); + /** + * creates an XmlItem + * Similar to createXmlItem but it also returns the http response headers . + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + */ + @RequestLine("POST /fake/create_xml_item") + @Headers({ + "Content-Type: application/xml", + "Accept: application/json", + }) + ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem); + + + /** * * Test serialization of outer boolean types @@ -48,6 +64,22 @@ public interface FakeApi extends ApiClient.Api { }) Boolean fakeOuterBooleanSerialize(Boolean body); + /** + * + * Similar to fakeOuterBooleanSerialize but it also returns the http response headers . + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body); + + + /** * * Test serialization of object with outer number type @@ -61,6 +93,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterComposite fakeOuterCompositeSerialize(OuterComposite body); + /** + * + * Similar to fakeOuterCompositeSerialize but it also returns the http response headers . + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body); + + + /** * * Test serialization of outer number types @@ -74,6 +122,22 @@ public interface FakeApi extends ApiClient.Api { }) BigDecimal fakeOuterNumberSerialize(BigDecimal body); + /** + * + * Similar to fakeOuterNumberSerialize but it also returns the http response headers . + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body); + + + /** * * Test serialization of outer string types @@ -87,6 +151,22 @@ public interface FakeApi extends ApiClient.Api { }) String fakeOuterStringSerialize(String body); + /** + * + * Similar to fakeOuterStringSerialize but it also returns the http response headers . + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + ApiResponse fakeOuterStringSerializeWithHttpInfo(String body); + + + /** * * For this test, the body for this request much reference a schema named `File`. @@ -99,6 +179,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithFileSchema(FileSchemaTestClass body); + /** + * + * Similar to testBodyWithFileSchema but it also returns the http response headers . + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + */ + @RequestLine("PUT /fake/body-with-file-schema") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body); + + + /** * * @@ -112,6 +207,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithQueryParams(@Param("query") String query, User body); + /** + * + * Similar to testBodyWithQueryParams but it also returns the http response headers . + * + * @param query (required) + * @param body (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User body); + + /** * * @@ -135,6 +245,26 @@ public interface FakeApi extends ApiClient.Api { void testBodyWithQueryParams(User body, @QueryMap(encoded=true) Map queryParams); /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param body (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query - (required)
  • + *
+ */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testBodyWithQueryParams method in a fluent style. */ @@ -158,6 +288,22 @@ public interface FakeApi extends ApiClient.Api { }) Client testClientModel(Client body); + /** + * To test \"client\" model + * Similar to testClientModel but it also returns the http response headers . + * To test \"client\" model + * @param body client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testClientModelWithHttpInfo(Client body); + + + /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -183,6 +329,34 @@ public interface FakeApi extends ApiClient.Api { }) void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Similar to testEndpointParameters but it also returns the http response headers . + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + */ + @RequestLine("POST /fake") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); + + + /** * To test enum parameters * To test enum parameters @@ -205,6 +379,30 @@ public interface FakeApi extends ApiClient.Api { }) void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + /** + * To test enum parameters + * Similar to testEnumParameters but it also returns the http response headers . + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + ApiResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + + /** * To test enum parameters * To test enum parameters @@ -237,6 +435,35 @@ public interface FakeApi extends ApiClient.Api { void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
  • enumQueryDouble - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + ApiResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testEnumParameters method in a fluent style. */ @@ -278,6 +505,27 @@ public interface FakeApi extends ApiClient.Api { }) void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + /** + * Fake endpoint to test group parameters (optional) + * Similar to testGroupParameters but it also returns the http response headers . + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + ApiResponse testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + + /** * Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional) @@ -307,6 +555,32 @@ public interface FakeApi extends ApiClient.Api { void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * Note, this is equivalent to the other testGroupParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param booleanGroup Boolean in group parameters (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • requiredStringGroup - Required String in group parameters (required)
  • + *
  • requiredInt64Group - Required Integer in group parameters (required)
  • + *
  • stringGroup - String in group parameters (optional)
  • + *
  • int64Group - Integer in group parameters (optional)
  • + *
+ */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + ApiResponse testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testGroupParameters method in a fluent style. */ @@ -341,6 +615,21 @@ public interface FakeApi extends ApiClient.Api { }) void testInlineAdditionalProperties(Map param); + /** + * test inline additionalProperties + * Similar to testInlineAdditionalProperties but it also returns the http response headers . + * + * @param param request body (required) + */ + @RequestLine("POST /fake/inline-additionalProperties") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param); + + + /** * test json serialization of form data * @@ -354,6 +643,22 @@ public interface FakeApi extends ApiClient.Api { }) void testJsonFormData(@Param("param") String param, @Param("param2") String param2); + /** + * test json serialization of form data + * Similar to testJsonFormData but it also returns the http response headers . + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @RequestLine("GET /fake/jsonFormData") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2); + + + /** * * To test the collection format in query parameters @@ -369,6 +674,23 @@ public interface FakeApi extends ApiClient.Api { }) void testQueryParameterCollectionFormat(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context); + /** + * + * Similar to testQueryParameterCollectionFormat but it also returns the http response headers . + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}") + @Headers({ + "Accept: application/json", + }) + ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context); + + /** * * To test the collection format in query parameters @@ -394,6 +716,28 @@ public interface FakeApi extends ApiClient.Api { void testQueryParameterCollectionFormat(@QueryMap(encoded=true) Map queryParams); /** + * + * To test the collection format in query parameters + * Note, this is equivalent to the other testQueryParameterCollectionFormat that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • pipe - (required)
  • + *
  • ioutil - (required)
  • + *
  • http - (required)
  • + *
  • url - (required)
  • + *
  • context - (required)
  • + *
+ */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}") + @Headers({ + "Accept: application/json", + }) + ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testQueryParameterCollectionFormat method in a fluent style. */ diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index c22fbfa8d74..61aea1a853a 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Client; @@ -27,4 +28,20 @@ public interface FakeClassnameTags123Api extends ApiClient.Api { "Accept: application/json", }) Client testClassname(Client body); + + /** + * To test class name in snake case + * Similar to testClassname but it also returns the http response headers . + * To test class name in snake case + * @param body client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testClassnameWithHttpInfo(Client body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java index cb7ab4bbe63..f94011fbe2d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import java.io.File; import org.openapitools.client.model.ModelApiResponse; @@ -30,6 +31,21 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet body); + /** + * Add a new pet to the store + * Similar to addPet but it also returns the http response headers . + * + * @param body Pet object that needs to be added to the store (required) + */ + @RequestLine("POST /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse addPetWithHttpInfo(Pet body); + + + /** * Deletes a pet * @@ -43,6 +59,22 @@ public interface PetApi extends ApiClient.Api { }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + /** + * Deletes a pet + * Similar to deletePet but it also returns the http response headers . + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Accept: application/json", + "api_key: {apiKey}" + }) + ApiResponse deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -55,6 +87,20 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByStatus(@Param("status") List status); + /** + * Finds Pets by status + * Similar to findPetsByStatus but it also returns the http response headers . + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByStatusWithHttpInfo(@Param("status") List status); + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -77,6 +123,25 @@ public interface PetApi extends ApiClient.Api { List findPetsByStatus(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByStatus method in a fluent style. */ @@ -101,6 +166,22 @@ public interface PetApi extends ApiClient.Api { }) Set findPetsByTags(@Param("tags") Set tags); + /** + * Finds Pets by tags + * Similar to findPetsByTags but it also returns the http response headers . + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByTagsWithHttpInfo(@Param("tags") Set tags); + + /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -125,6 +206,27 @@ public interface PetApi extends ApiClient.Api { Set findPetsByTags(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return Set<Pet> + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByTags method in a fluent style. */ @@ -147,6 +249,21 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long petId); + /** + * Find pet by ID + * Similar to getPetById but it also returns the http response headers . + * Returns a single pet + * @param petId ID of pet to return (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /pet/{petId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getPetByIdWithHttpInfo(@Param("petId") Long petId); + + + /** * Update an existing pet * @@ -159,6 +276,21 @@ public interface PetApi extends ApiClient.Api { }) void updatePet(Pet body); + /** + * Update an existing pet + * Similar to updatePet but it also returns the http response headers . + * + * @param body Pet object that needs to be added to the store (required) + */ + @RequestLine("PUT /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse updatePetWithHttpInfo(Pet body); + + + /** * Updates a pet in the store with form data * @@ -173,6 +305,23 @@ public interface PetApi extends ApiClient.Api { }) void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + /** + * Updates a pet in the store with form data + * Similar to updatePetWithForm but it also returns the http response headers . + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + + + /** * uploads an image * @@ -188,6 +337,24 @@ public interface PetApi extends ApiClient.Api { }) ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + /** + * uploads an image + * Similar to uploadFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ApiResponse uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + + + /** * uploads an image (required) * @@ -202,4 +369,22 @@ public interface PetApi extends ApiClient.Api { "Accept: application/json", }) ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + /** + * uploads an image (required) + * Similar to uploadFileWithRequiredFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ApiResponse uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java index 5ba8227e99b..9b821d4302d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Order; @@ -26,6 +27,20 @@ public interface StoreApi extends ApiClient.Api { }) void deleteOrder(@Param("orderId") String orderId); + /** + * Delete purchase order by ID + * Similar to deleteOrder but it also returns the http response headers . + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse deleteOrderWithHttpInfo(@Param("orderId") String orderId); + + + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -37,6 +52,20 @@ public interface StoreApi extends ApiClient.Api { }) Map getInventory(); + /** + * Returns pet inventories by status + * Similar to getInventory but it also returns the http response headers . + * Returns a map of status codes to quantities + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /store/inventory") + @Headers({ + "Accept: application/json", + }) + ApiResponse> getInventoryWithHttpInfo(); + + + /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -49,6 +78,21 @@ public interface StoreApi extends ApiClient.Api { }) Order getOrderById(@Param("orderId") Long orderId); + /** + * Find purchase order by ID + * Similar to getOrderById but it also returns the http response headers . + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getOrderByIdWithHttpInfo(@Param("orderId") Long orderId); + + + /** * Place an order for a pet * @@ -61,4 +105,20 @@ public interface StoreApi extends ApiClient.Api { "Accept: application/json", }) Order placeOrder(Order body); + + /** + * Place an order for a pet + * Similar to placeOrder but it also returns the http response headers . + * + * @param body order placed for purchasing the pet (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /store/order") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + ApiResponse placeOrderWithHttpInfo(Order body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java index 40b6010dab2..d97f8235c4d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.User; @@ -27,6 +28,21 @@ public interface UserApi extends ApiClient.Api { }) void createUser(User body); + /** + * Create user + * Similar to createUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param body Created user object (required) + */ + @RequestLine("POST /user") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + ApiResponse createUserWithHttpInfo(User body); + + + /** * Creates list of users with given input array * @@ -39,6 +55,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithArrayInput(List body); + /** + * Creates list of users with given input array + * Similar to createUsersWithArrayInput but it also returns the http response headers . + * + * @param body List of user object (required) + */ + @RequestLine("POST /user/createWithArray") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + ApiResponse createUsersWithArrayInputWithHttpInfo(List body); + + + /** * Creates list of users with given input array * @@ -51,6 +82,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithListInput(List body); + /** + * Creates list of users with given input array + * Similar to createUsersWithListInput but it also returns the http response headers . + * + * @param body List of user object (required) + */ + @RequestLine("POST /user/createWithList") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + ApiResponse createUsersWithListInputWithHttpInfo(List body); + + + /** * Delete user * This can only be done by the logged in user. @@ -62,6 +108,20 @@ public interface UserApi extends ApiClient.Api { }) void deleteUser(@Param("username") String username); + /** + * Delete user + * Similar to deleteUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Accept: application/json", + }) + ApiResponse deleteUserWithHttpInfo(@Param("username") String username); + + + /** * Get user by user name * @@ -74,6 +134,21 @@ public interface UserApi extends ApiClient.Api { }) User getUserByName(@Param("username") String username); + /** + * Get user by user name + * Similar to getUserByName but it also returns the http response headers . + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getUserByNameWithHttpInfo(@Param("username") String username); + + + /** * Logs user into the system * @@ -87,6 +162,21 @@ public interface UserApi extends ApiClient.Api { }) String loginUser(@Param("username") String username, @Param("password") String password); + /** + * Logs user into the system + * Similar to loginUser but it also returns the http response headers . + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + ApiResponse loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password); + + /** * Logs user into the system * @@ -110,6 +200,26 @@ public interface UserApi extends ApiClient.Api { String loginUser(@QueryMap(encoded=true) Map queryParams); /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + ApiResponse loginUserWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * loginUser method in a fluent style. */ @@ -134,6 +244,19 @@ public interface UserApi extends ApiClient.Api { }) void logoutUser(); + /** + * Logs out current logged in user session + * Similar to logoutUser but it also returns the http response headers . + * + */ + @RequestLine("GET /user/logout") + @Headers({ + "Accept: application/json", + }) + ApiResponse logoutUserWithHttpInfo(); + + + /** * Updated user * This can only be done by the logged in user. @@ -146,4 +269,20 @@ public interface UserApi extends ApiClient.Api { "Accept: application/json", }) void updateUser(@Param("username") String username, User body); + + /** + * Updated user + * Similar to updateUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + */ + @RequestLine("PUT /user/{username}") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + ApiResponse updateUserWithHttpInfo(@Param("username") String username, User body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java index 4ddfc678e92..2a33ff9434a 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java @@ -5,7 +5,7 @@ import feign.RetryableException; import feign.codec.ErrorDecoder; /** - * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token + * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token * All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder */ public class ApiErrorDecoder implements ErrorDecoder { diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ApiResponse.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ApiResponse.java new file mode 100644 index 00000000000..a0d44e724c5 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ApiResponse.java @@ -0,0 +1,43 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.List; + +public class ApiResponse{ + + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } + +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java new file mode 100644 index 00000000000..f0e57a0af73 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java @@ -0,0 +1,31 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.Collection; + +public class HttpResponse{ + + private Map> headers; + + private T body; + + private int status; + + public HttpResponse(Map> headers, T body, int status) { + this.headers = headers; + this.body = body; + this.status = status; + } + + public T getBody(){ + return body; + } + + public Map> getHeaders(){ + return headers; + } + + public int getStatus(){ + return status; + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/.openapi-generator/FILES b/samples/client/petstore/java/feign/.openapi-generator/FILES index 81350a81f2d..9dd7f3f9097 100644 --- a/samples/client/petstore/java/feign/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign/.openapi-generator/FILES @@ -14,6 +14,7 @@ pom.xml settings.gradle src/main/AndroidManifest.xml src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiResponseDecoder.java src/main/java/org/openapitools/client/CustomInstantDeserializer.java src/main/java/org/openapitools/client/EncodingUtils.java src/main/java/org/openapitools/client/ParamExpander.java @@ -39,6 +40,7 @@ src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/ApiResponse.java src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayTest.java diff --git a/samples/client/petstore/java/feign/gradle.properties b/samples/client/petstore/java/feign/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/feign/gradle.properties +++ b/samples/client/petstore/java/feign/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/feign/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/feign/gradlew b/samples/client/petstore/java/feign/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/feign/gradlew +++ b/samples/client/petstore/java/feign/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/feign/gradlew.bat b/samples/client/petstore/java/feign/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/feign/gradlew.bat +++ b/samples/client/petstore/java/feign/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 38890aba17e..4cb1a3343fa 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -23,6 +23,7 @@ import feign.slf4j.Slf4jLogger; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.ApiResponseDecoder; import org.openapitools.client.auth.ApiErrorDecoder; import org.openapitools.client.auth.OAuth; @@ -49,7 +50,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new ApiResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiResponseDecoder.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiResponseDecoder.java new file mode 100644 index 00000000000..d74d1d8768d --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiResponseDecoder.java @@ -0,0 +1,38 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import org.openapitools.client.model.ApiResponse; + +public class ApiResponseDecoder extends JacksonDecoder { + + public ApiResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class ApiResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new ApiResponse(response.status(), responseHeaders, body); + } else { + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java new file mode 100644 index 00000000000..b3db8c605ab --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java @@ -0,0 +1,38 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import org.openapitools.client.model.HttpResponse; + +public class JacksonResponseDecoder extends JacksonDecoder { + + public JacksonResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class HttpResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) { + //The HttpResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new HttpResponse(responseHeaders, body, response.status()); + } else { + //The response is not encapsulated in the HttpResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index a7d60c2b64f..77d0c2ad878 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Client; @@ -27,4 +28,20 @@ public interface AnotherFakeApi extends ApiClient.Api { "Accept: application/json", }) Client call123testSpecialTags(Client client); + + /** + * To test special tags + * Similar to call123testSpecialTags but it also returns the http response headers . + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /another-fake/dummy") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse call123testSpecialTagsWithHttpInfo(Client client); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java index cd9b94c2e12..2b69f9144ec 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.InlineResponseDefault; @@ -25,4 +26,18 @@ public interface DefaultApi extends ApiClient.Api { "Accept: application/json", }) InlineResponseDefault fooGet(); + + /** + * + * Similar to fooGet but it also returns the http response headers . + * + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /foo") + @Headers({ + "Accept: application/json", + }) + ApiResponse fooGetWithHttpInfo(); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java index 85ef53e3695..915a61d9584 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; @@ -36,6 +37,20 @@ public interface FakeApi extends ApiClient.Api { }) HealthCheckResult fakeHealthGet(); + /** + * Health check endpoint + * Similar to fakeHealthGet but it also returns the http response headers . + * + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /fake/health") + @Headers({ + "Accept: application/json", + }) + ApiResponse fakeHealthGetWithHttpInfo(); + + + /** * test http signature authentication * @@ -51,6 +66,23 @@ public interface FakeApi extends ApiClient.Api { }) void fakeHttpSignatureTest(Pet pet, @Param("query1") String query1, @Param("header1") String header1); + /** + * test http signature authentication + * Similar to fakeHttpSignatureTest but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + */ + @RequestLine("GET /fake/http-signature-test?query_1={query1}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + "header_1: {header1}" + }) + ApiResponse fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("query1") String query1, @Param("header1") String header1); + + /** * test http signature authentication * @@ -76,6 +108,28 @@ public interface FakeApi extends ApiClient.Api { void fakeHttpSignatureTest(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map queryParams); /** + * test http signature authentication + * + * Note, this is equivalent to the other fakeHttpSignatureTest that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param pet Pet object that needs to be added to the store (required) + * @param header1 header parameter (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query1 - query parameter (optional)
  • + *
+ */ + @RequestLine("GET /fake/http-signature-test?query_1={query1}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + "header_1: {header1}" + }) + ApiResponse fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * fakeHttpSignatureTest method in a fluent style. */ @@ -99,6 +153,22 @@ public interface FakeApi extends ApiClient.Api { }) Boolean fakeOuterBooleanSerialize(Boolean body); + /** + * + * Similar to fakeOuterBooleanSerialize but it also returns the http response headers . + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body); + + + /** * * Test serialization of object with outer number type @@ -112,6 +182,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite); + /** + * + * Similar to fakeOuterCompositeSerialize but it also returns the http response headers . + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite); + + + /** * * Test serialization of outer number types @@ -125,6 +211,22 @@ public interface FakeApi extends ApiClient.Api { }) BigDecimal fakeOuterNumberSerialize(BigDecimal body); + /** + * + * Similar to fakeOuterNumberSerialize but it also returns the http response headers . + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body); + + + /** * * Test serialization of outer string types @@ -138,6 +240,22 @@ public interface FakeApi extends ApiClient.Api { }) String fakeOuterStringSerialize(String body); + /** + * + * Similar to fakeOuterStringSerialize but it also returns the http response headers . + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + ApiResponse fakeOuterStringSerializeWithHttpInfo(String body); + + + /** * * Test serialization of enum (int) properties with examples @@ -151,6 +269,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty); + /** + * + * Similar to fakePropertyEnumIntegerSerialize but it also returns the http response headers . + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/property/enum-int") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + ApiResponse fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty); + + + /** * * For this test, the body has to be a binary file. @@ -163,6 +297,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithBinary(File body); + /** + * + * Similar to testBodyWithBinary but it also returns the http response headers . + * For this test, the body has to be a binary file. + * @param body image to upload (required) + */ + @RequestLine("PUT /fake/body-with-binary") + @Headers({ + "Content-Type: image/png", + "Accept: application/json", + }) + ApiResponse testBodyWithBinaryWithHttpInfo(File body); + + + /** * * For this test, the body for this request must reference a schema named `File`. @@ -175,6 +324,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + /** + * + * Similar to testBodyWithFileSchema but it also returns the http response headers . + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + */ + @RequestLine("PUT /fake/body-with-file-schema") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass); + + + /** * * @@ -188,6 +352,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithQueryParams(@Param("query") String query, User user); + /** + * + * Similar to testBodyWithQueryParams but it also returns the http response headers . + * + * @param query (required) + * @param user (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User user); + + /** * * @@ -211,6 +390,26 @@ public interface FakeApi extends ApiClient.Api { void testBodyWithQueryParams(User user, @QueryMap(encoded=true) Map queryParams); /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param user (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query - (required)
  • + *
+ */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testBodyWithQueryParamsWithHttpInfo(User user, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testBodyWithQueryParams method in a fluent style. */ @@ -234,6 +433,22 @@ public interface FakeApi extends ApiClient.Api { }) Client testClientModel(Client client); + /** + * To test \"client\" model + * Similar to testClientModel but it also returns the http response headers . + * To test \"client\" model + * @param client client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testClientModelWithHttpInfo(Client client); + + + /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -259,6 +474,34 @@ public interface FakeApi extends ApiClient.Api { }) void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Similar to testEndpointParameters but it also returns the http response headers . + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + */ + @RequestLine("POST /fake") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); + + + /** * To test enum parameters * To test enum parameters @@ -281,6 +524,30 @@ public interface FakeApi extends ApiClient.Api { }) void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + /** + * To test enum parameters + * Similar to testEnumParameters but it also returns the http response headers . + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + ApiResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + + /** * To test enum parameters * To test enum parameters @@ -313,6 +580,35 @@ public interface FakeApi extends ApiClient.Api { void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
  • enumQueryDouble - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + ApiResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testEnumParameters method in a fluent style. */ @@ -354,6 +650,27 @@ public interface FakeApi extends ApiClient.Api { }) void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + /** + * Fake endpoint to test group parameters (optional) + * Similar to testGroupParameters but it also returns the http response headers . + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + ApiResponse testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + + /** * Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional) @@ -383,6 +700,32 @@ public interface FakeApi extends ApiClient.Api { void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * Note, this is equivalent to the other testGroupParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param booleanGroup Boolean in group parameters (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • requiredStringGroup - Required String in group parameters (required)
  • + *
  • requiredInt64Group - Required Integer in group parameters (required)
  • + *
  • stringGroup - String in group parameters (optional)
  • + *
  • int64Group - Integer in group parameters (optional)
  • + *
+ */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + ApiResponse testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testGroupParameters method in a fluent style. */ @@ -417,6 +760,21 @@ public interface FakeApi extends ApiClient.Api { }) void testInlineAdditionalProperties(Map requestBody); + /** + * test inline additionalProperties + * Similar to testInlineAdditionalProperties but it also returns the http response headers . + * + * @param requestBody request body (required) + */ + @RequestLine("POST /fake/inline-additionalProperties") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody); + + + /** * test json serialization of form data * @@ -430,6 +788,22 @@ public interface FakeApi extends ApiClient.Api { }) void testJsonFormData(@Param("param") String param, @Param("param2") String param2); + /** + * test json serialization of form data + * Similar to testJsonFormData but it also returns the http response headers . + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @RequestLine("GET /fake/jsonFormData") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2); + + + /** * * To test the collection format in query parameters @@ -447,6 +821,25 @@ public interface FakeApi extends ApiClient.Api { }) void testQueryParameterCollectionFormat(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context, @Param("allowEmpty") String allowEmpty, @Param("language") Map language); + /** + * + * Similar to testQueryParameterCollectionFormat but it also returns the http response headers . + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}&language={language}&allowEmpty={allowEmpty}") + @Headers({ + "Accept: application/json", + }) + ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context, @Param("allowEmpty") String allowEmpty, @Param("language") Map language); + + /** * * To test the collection format in query parameters @@ -474,6 +867,30 @@ public interface FakeApi extends ApiClient.Api { void testQueryParameterCollectionFormat(@QueryMap(encoded=true) Map queryParams); /** + * + * To test the collection format in query parameters + * Note, this is equivalent to the other testQueryParameterCollectionFormat that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • pipe - (required)
  • + *
  • ioutil - (required)
  • + *
  • http - (required)
  • + *
  • url - (required)
  • + *
  • context - (required)
  • + *
  • language - (optional)
  • + *
  • allowEmpty - (required)
  • + *
+ */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}&language={language}&allowEmpty={allowEmpty}") + @Headers({ + "Accept: application/json", + }) + ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testQueryParameterCollectionFormat method in a fluent style. */ diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 17c6bfa6695..52bc9873d97 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Client; @@ -27,4 +28,20 @@ public interface FakeClassnameTags123Api extends ApiClient.Api { "Accept: application/json", }) Client testClassname(Client client); + + /** + * To test class name in snake case + * Similar to testClassname but it also returns the http response headers . + * To test class name in snake case + * @param client client model (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testClassnameWithHttpInfo(Client client); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java index 10cb8950f63..a57cd9481b9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import java.io.File; import org.openapitools.client.model.ModelApiResponse; @@ -30,6 +31,21 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet pet); + /** + * Add a new pet to the store + * Similar to addPet but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("POST /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse addPetWithHttpInfo(Pet pet); + + + /** * Deletes a pet * @@ -43,6 +59,22 @@ public interface PetApi extends ApiClient.Api { }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + /** + * Deletes a pet + * Similar to deletePet but it also returns the http response headers . + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Accept: application/json", + "api_key: {apiKey}" + }) + ApiResponse deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -55,6 +87,20 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByStatus(@Param("status") List status); + /** + * Finds Pets by status + * Similar to findPetsByStatus but it also returns the http response headers . + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByStatusWithHttpInfo(@Param("status") List status); + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -77,6 +123,25 @@ public interface PetApi extends ApiClient.Api { List findPetsByStatus(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByStatus method in a fluent style. */ @@ -101,6 +166,22 @@ public interface PetApi extends ApiClient.Api { }) Set findPetsByTags(@Param("tags") Set tags); + /** + * Finds Pets by tags + * Similar to findPetsByTags but it also returns the http response headers . + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByTagsWithHttpInfo(@Param("tags") Set tags); + + /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -125,6 +206,27 @@ public interface PetApi extends ApiClient.Api { Set findPetsByTags(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return Set<Pet> + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + ApiResponse> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByTags method in a fluent style. */ @@ -147,6 +249,21 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long petId); + /** + * Find pet by ID + * Similar to getPetById but it also returns the http response headers . + * Returns a single pet + * @param petId ID of pet to return (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /pet/{petId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getPetByIdWithHttpInfo(@Param("petId") Long petId); + + + /** * Update an existing pet * @@ -159,6 +276,21 @@ public interface PetApi extends ApiClient.Api { }) void updatePet(Pet pet); + /** + * Update an existing pet + * Similar to updatePet but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("PUT /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse updatePetWithHttpInfo(Pet pet); + + + /** * Updates a pet in the store with form data * @@ -173,6 +305,23 @@ public interface PetApi extends ApiClient.Api { }) void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + /** + * Updates a pet in the store with form data + * Similar to updatePetWithForm but it also returns the http response headers . + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + ApiResponse updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + + + /** * uploads an image * @@ -188,6 +337,24 @@ public interface PetApi extends ApiClient.Api { }) ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + /** + * uploads an image + * Similar to uploadFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ApiResponse uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + + + /** * uploads an image (required) * @@ -202,4 +369,22 @@ public interface PetApi extends ApiClient.Api { "Accept: application/json", }) ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + /** + * uploads an image (required) + * Similar to uploadFileWithRequiredFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ApiResponse uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java index 21611cabe79..c5cefaa7a4b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.Order; @@ -26,6 +27,20 @@ public interface StoreApi extends ApiClient.Api { }) void deleteOrder(@Param("orderId") String orderId); + /** + * Delete purchase order by ID + * Similar to deleteOrder but it also returns the http response headers . + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse deleteOrderWithHttpInfo(@Param("orderId") String orderId); + + + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -37,6 +52,20 @@ public interface StoreApi extends ApiClient.Api { }) Map getInventory(); + /** + * Returns pet inventories by status + * Similar to getInventory but it also returns the http response headers . + * Returns a map of status codes to quantities + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /store/inventory") + @Headers({ + "Accept: application/json", + }) + ApiResponse> getInventoryWithHttpInfo(); + + + /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -49,6 +78,21 @@ public interface StoreApi extends ApiClient.Api { }) Order getOrderById(@Param("orderId") Long orderId); + /** + * Find purchase order by ID + * Similar to getOrderById but it also returns the http response headers . + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getOrderByIdWithHttpInfo(@Param("orderId") Long orderId); + + + /** * Place an order for a pet * @@ -61,4 +105,20 @@ public interface StoreApi extends ApiClient.Api { "Accept: application/json", }) Order placeOrder(Order order); + + /** + * Place an order for a pet + * Similar to placeOrder but it also returns the http response headers . + * + * @param order order placed for purchasing the pet (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /store/order") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse placeOrderWithHttpInfo(Order order); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java index f7f9fcb3194..c6a74a80c00 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.ApiResponse; import org.openapitools.client.model.User; @@ -27,6 +28,21 @@ public interface UserApi extends ApiClient.Api { }) void createUser(User user); + /** + * Create user + * Similar to createUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param user Created user object (required) + */ + @RequestLine("POST /user") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse createUserWithHttpInfo(User user); + + + /** * Creates list of users with given input array * @@ -39,6 +55,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithArrayInput(List user); + /** + * Creates list of users with given input array + * Similar to createUsersWithArrayInput but it also returns the http response headers . + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithArray") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse createUsersWithArrayInputWithHttpInfo(List user); + + + /** * Creates list of users with given input array * @@ -51,6 +82,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithListInput(List user); + /** + * Creates list of users with given input array + * Similar to createUsersWithListInput but it also returns the http response headers . + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithList") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse createUsersWithListInputWithHttpInfo(List user); + + + /** * Delete user * This can only be done by the logged in user. @@ -62,6 +108,20 @@ public interface UserApi extends ApiClient.Api { }) void deleteUser(@Param("username") String username); + /** + * Delete user + * Similar to deleteUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Accept: application/json", + }) + ApiResponse deleteUserWithHttpInfo(@Param("username") String username); + + + /** * Get user by user name * @@ -74,6 +134,21 @@ public interface UserApi extends ApiClient.Api { }) User getUserByName(@Param("username") String username); + /** + * Get user by user name + * Similar to getUserByName but it also returns the http response headers . + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Accept: application/json", + }) + ApiResponse getUserByNameWithHttpInfo(@Param("username") String username); + + + /** * Logs user into the system * @@ -87,6 +162,21 @@ public interface UserApi extends ApiClient.Api { }) String loginUser(@Param("username") String username, @Param("password") String password); + /** + * Logs user into the system + * Similar to loginUser but it also returns the http response headers . + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + ApiResponse loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password); + + /** * Logs user into the system * @@ -110,6 +200,26 @@ public interface UserApi extends ApiClient.Api { String loginUser(@QueryMap(encoded=true) Map queryParams); /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + ApiResponse loginUserWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * loginUser method in a fluent style. */ @@ -134,6 +244,19 @@ public interface UserApi extends ApiClient.Api { }) void logoutUser(); + /** + * Logs out current logged in user session + * Similar to logoutUser but it also returns the http response headers . + * + */ + @RequestLine("GET /user/logout") + @Headers({ + "Accept: application/json", + }) + ApiResponse logoutUserWithHttpInfo(); + + + /** * Updated user * This can only be done by the logged in user. @@ -146,4 +269,20 @@ public interface UserApi extends ApiClient.Api { "Accept: application/json", }) void updateUser(@Param("username") String username, User user); + + /** + * Updated user + * Similar to updateUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + */ + @RequestLine("PUT /user/{username}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse updateUserWithHttpInfo(@Param("username") String username, User user); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java index 4ddfc678e92..2a33ff9434a 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java @@ -5,7 +5,7 @@ import feign.RetryableException; import feign.codec.ErrorDecoder; /** - * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token + * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token * All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder */ public class ApiErrorDecoder implements ErrorDecoder { diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ApiResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ApiResponse.java new file mode 100644 index 00000000000..a0d44e724c5 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ApiResponse.java @@ -0,0 +1,43 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.List; + +public class ApiResponse{ + + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } + +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java new file mode 100644 index 00000000000..f0e57a0af73 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java @@ -0,0 +1,31 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.Collection; + +public class HttpResponse{ + + private Map> headers; + + private T body; + + private int status; + + public HttpResponse(Map> headers, T body, int status) { + this.headers = headers; + this.body = body; + this.status = status; + } + + public T getBody(){ + return body; + } + + public Map> getHeaders(){ + return headers; + } + + public int getStatus(){ + return status; + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/google-api-client/README.md b/samples/client/petstore/java/google-api-client/README.md index 28d54d37dd3..71f36e20665 100644 --- a/samples/client/petstore/java/google-api-client/README.md +++ b/samples/client/petstore/java/google-api-client/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-google-api-client:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-google-api-client' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-google-api-client' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-google-api-client:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/google-api-client/gradle.properties b/samples/client/petstore/java/google-api-client/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/google-api-client/gradle.properties +++ b/samples/client/petstore/java/google-api-client/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/google-api-client/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/google-api-client/gradlew b/samples/client/petstore/java/google-api-client/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/google-api-client/gradlew +++ b/samples/client/petstore/java/google-api-client/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/google-api-client/gradlew.bat b/samples/client/petstore/java/google-api-client/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/google-api-client/gradlew.bat +++ b/samples/client/petstore/java/google-api-client/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey1/README.md b/samples/client/petstore/java/jersey1/README.md index 1b77ba89cf8..1ee4072792d 100644 --- a/samples/client/petstore/java/jersey1/README.md +++ b/samples/client/petstore/java/jersey1/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-java-client-jersey1:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-java-client-jersey1' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-java-client-jersey1' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-java-client-jersey1:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index ad75b3eaeb9..fdcf9b78ae4 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -78,14 +76,18 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-java-client-jersey1' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-java-client-jersey1' + + from components.java + } } } diff --git a/samples/client/petstore/java/jersey1/gradle.properties b/samples/client/petstore/java/jersey1/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/jersey1/gradle.properties +++ b/samples/client/petstore/java/jersey1/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey1/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey1/gradlew b/samples/client/petstore/java/jersey1/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/jersey1/gradlew +++ b/samples/client/petstore/java/jersey1/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/jersey1/gradlew.bat b/samples/client/petstore/java/jersey1/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/jersey1/gradlew.bat +++ b/samples/client/petstore/java/jersey1/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/README.md b/samples/client/petstore/java/jersey2-java8-localdatetime/README.md index 352959892aa..0a774fa64d0 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/README.md +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/README.md @@ -14,7 +14,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.8+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-jersey2-java8-localdatetime:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-jersey2-java8-localdatetime' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-jersey2-java8-localdatetime' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-jersey2-java8-localdatetime:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle index 70f7fb88421..e70647c7424 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -77,13 +75,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-jersey2-java8-localdatetime' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-jersey2-java8-localdatetime' + + from components.java + } } } diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle.properties b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle.properties +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew b/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew.bat b/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew.bat +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/jersey2-java8/README.md b/samples/client/petstore/java/jersey2-java8/README.md index 21010fa5412..982cb0b1712 100644 --- a/samples/client/petstore/java/jersey2-java8/README.md +++ b/samples/client/petstore/java/jersey2-java8/README.md @@ -14,7 +14,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.8+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-jersey2-java8:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-jersey2-java8' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-jersey2-java8' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-jersey2-java8:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index 84fe3e2c33d..ba735353092 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -77,13 +75,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-jersey2-java8' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-jersey2-java8' + + from components.java + } } } diff --git a/samples/client/petstore/java/jersey2-java8/gradle.properties b/samples/client/petstore/java/jersey2-java8/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/jersey2-java8/gradle.properties +++ b/samples/client/petstore/java/jersey2-java8/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2-java8/gradlew b/samples/client/petstore/java/jersey2-java8/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/jersey2-java8/gradlew +++ b/samples/client/petstore/java/jersey2-java8/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/jersey2-java8/gradlew.bat b/samples/client/petstore/java/jersey2-java8/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/jersey2-java8/gradlew.bat +++ b/samples/client/petstore/java/jersey2-java8/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/native-async/gradlew b/samples/client/petstore/java/native-async/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/native-async/gradlew +++ b/samples/client/petstore/java/native-async/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native-async/gradlew.bat b/samples/client/petstore/java/native-async/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/native-async/gradlew.bat +++ b/samples/client/petstore/java/native-async/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/native/gradlew b/samples/client/petstore/java/native/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/native/gradlew +++ b/samples/client/petstore/java/native/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native/gradlew.bat b/samples/client/petstore/java/native/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/native/gradlew.bat +++ b/samples/client/petstore/java/native/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle.properties b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle.properties +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew index 4f906e0c811..005bcde0428 100755 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew.bat b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew.bat +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/okhttp-gson/gradle.properties b/samples/client/petstore/java/okhttp-gson/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/okhttp-gson/gradle.properties +++ b/samples/client/petstore/java/okhttp-gson/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/okhttp-gson/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/okhttp-gson/gradlew b/samples/client/petstore/java/okhttp-gson/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/okhttp-gson/gradlew +++ b/samples/client/petstore/java/okhttp-gson/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-gson/gradlew.bat b/samples/client/petstore/java/okhttp-gson/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/okhttp-gson/gradlew.bat +++ b/samples/client/petstore/java/okhttp-gson/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/rest-assured-jackson/gradle.properties b/samples/client/petstore/java/rest-assured-jackson/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/rest-assured-jackson/gradle.properties +++ b/samples/client/petstore/java/rest-assured-jackson/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/rest-assured-jackson/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/rest-assured-jackson/gradlew b/samples/client/petstore/java/rest-assured-jackson/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/rest-assured-jackson/gradlew +++ b/samples/client/petstore/java/rest-assured-jackson/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/rest-assured-jackson/gradlew.bat b/samples/client/petstore/java/rest-assured-jackson/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/rest-assured-jackson/gradlew.bat +++ b/samples/client/petstore/java/rest-assured-jackson/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/rest-assured/gradle.properties b/samples/client/petstore/java/rest-assured/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/rest-assured/gradle.properties +++ b/samples/client/petstore/java/rest-assured/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/rest-assured/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/rest-assured/gradlew b/samples/client/petstore/java/rest-assured/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/rest-assured/gradlew +++ b/samples/client/petstore/java/rest-assured/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/rest-assured/gradlew.bat b/samples/client/petstore/java/rest-assured/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/rest-assured/gradlew.bat +++ b/samples/client/petstore/java/rest-assured/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 76e72e161d4..0c870fbabb3 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-resteasy:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-resteasy' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-resteasy' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-resteasy:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/resteasy/gradle.properties b/samples/client/petstore/java/resteasy/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/resteasy/gradle.properties +++ b/samples/client/petstore/java/resteasy/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resteasy/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resteasy/gradlew b/samples/client/petstore/java/resteasy/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/resteasy/gradlew +++ b/samples/client/petstore/java/resteasy/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/resteasy/gradlew.bat b/samples/client/petstore/java/resteasy/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/resteasy/gradlew.bat +++ b/samples/client/petstore/java/resteasy/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index 79f62ec9e8a..8fdc6181a98 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-resttemplate-withxml:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-resttemplate-withxml' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-resttemplate-withxml' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-resttemplate-withxml:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/resttemplate-withXml/gradle.properties b/samples/client/petstore/java/resttemplate-withXml/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradle.properties +++ b/samples/client/petstore/java/resttemplate-withXml/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resttemplate-withXml/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resttemplate-withXml/gradlew b/samples/client/petstore/java/resttemplate-withXml/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradlew +++ b/samples/client/petstore/java/resttemplate-withXml/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/resttemplate-withXml/gradlew.bat b/samples/client/petstore/java/resttemplate-withXml/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/resttemplate-withXml/gradlew.bat +++ b/samples/client/petstore/java/resttemplate-withXml/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index 87cb5a0cc9c..fec37d43ba5 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-resttemplate:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-resttemplate' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-resttemplate' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-resttemplate:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/resttemplate/gradle.properties b/samples/client/petstore/java/resttemplate/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/resttemplate/gradle.properties +++ b/samples/client/petstore/java/resttemplate/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/resttemplate/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/resttemplate/gradlew b/samples/client/petstore/java/resttemplate/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/resttemplate/gradlew +++ b/samples/client/petstore/java/resttemplate/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/resttemplate/gradlew.bat b/samples/client/petstore/java/resttemplate/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/resttemplate/gradlew.bat +++ b/samples/client/petstore/java/resttemplate/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2-play26/gradle.properties b/samples/client/petstore/java/retrofit2-play26/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradle.properties +++ b/samples/client/petstore/java/retrofit2-play26/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew b/samples/client/petstore/java/retrofit2-play26/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradlew +++ b/samples/client/petstore/java/retrofit2-play26/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew.bat b/samples/client/petstore/java/retrofit2-play26/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/retrofit2-play26/gradlew.bat +++ b/samples/client/petstore/java/retrofit2-play26/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2/gradle.properties b/samples/client/petstore/java/retrofit2/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/retrofit2/gradle.properties +++ b/samples/client/petstore/java/retrofit2/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2/gradlew b/samples/client/petstore/java/retrofit2/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/retrofit2/gradlew +++ b/samples/client/petstore/java/retrofit2/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/retrofit2/gradlew.bat b/samples/client/petstore/java/retrofit2/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/retrofit2/gradlew.bat +++ b/samples/client/petstore/java/retrofit2/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2rx2/gradle.properties b/samples/client/petstore/java/retrofit2rx2/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradle.properties +++ b/samples/client/petstore/java/retrofit2rx2/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2rx2/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2rx2/gradlew b/samples/client/petstore/java/retrofit2rx2/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradlew +++ b/samples/client/petstore/java/retrofit2rx2/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/retrofit2rx2/gradlew.bat b/samples/client/petstore/java/retrofit2rx2/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/retrofit2rx2/gradlew.bat +++ b/samples/client/petstore/java/retrofit2rx2/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/retrofit2rx3/gradle.properties b/samples/client/petstore/java/retrofit2rx3/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/retrofit2rx3/gradle.properties +++ b/samples/client/petstore/java/retrofit2rx3/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2rx3/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/retrofit2rx3/gradlew b/samples/client/petstore/java/retrofit2rx3/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/retrofit2rx3/gradlew +++ b/samples/client/petstore/java/retrofit2rx3/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/retrofit2rx3/gradlew.bat b/samples/client/petstore/java/retrofit2rx3/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/retrofit2rx3/gradlew.bat +++ b/samples/client/petstore/java/retrofit2rx3/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/vertx-no-nullable/README.md b/samples/client/petstore/java/vertx-no-nullable/README.md index 14a2bd16e11..34fb7c44be6 100644 --- a/samples/client/petstore/java/vertx-no-nullable/README.md +++ b/samples/client/petstore/java/vertx-no-nullable/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-vertx-no-nullable:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-vertx-no-nullable' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-vertx-no-nullable' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-vertx-no-nullable:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/vertx-no-nullable/gradle.properties b/samples/client/petstore/java/vertx-no-nullable/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/vertx-no-nullable/gradle.properties +++ b/samples/client/petstore/java/vertx-no-nullable/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/vertx-no-nullable/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/vertx-no-nullable/gradlew b/samples/client/petstore/java/vertx-no-nullable/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/vertx-no-nullable/gradlew +++ b/samples/client/petstore/java/vertx-no-nullable/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/vertx-no-nullable/gradlew.bat b/samples/client/petstore/java/vertx-no-nullable/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/vertx-no-nullable/gradlew.bat +++ b/samples/client/petstore/java/vertx-no-nullable/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/vertx/README.md b/samples/client/petstore/java/vertx/README.md index dd6d48dbbe7..a463020f75b 100644 --- a/samples/client/petstore/java/vertx/README.md +++ b/samples/client/petstore/java/vertx/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-vertx:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-vertx' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-vertx' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-vertx:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/vertx/gradle.properties b/samples/client/petstore/java/vertx/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/vertx/gradle.properties +++ b/samples/client/petstore/java/vertx/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/vertx/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/vertx/gradlew b/samples/client/petstore/java/vertx/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/vertx/gradlew +++ b/samples/client/petstore/java/vertx/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/vertx/gradlew.bat b/samples/client/petstore/java/vertx/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/vertx/gradlew.bat +++ b/samples/client/petstore/java/vertx/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/webclient-nulable-arrays/README.md b/samples/client/petstore/java/webclient-nulable-arrays/README.md index c74918e7d1c..d290aad0498 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/README.md +++ b/samples/client/petstore/java/webclient-nulable-arrays/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-webclient-nullable-arrays:v1" + repositories { + mavenCentral() // Needed if the 'petstore-webclient-nullable-arrays' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-webclient-nullable-arrays' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-webclient-nullable-arrays:v1" + } ``` ### Others diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradle.properties b/samples/client/petstore/java/webclient-nulable-arrays/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/gradle.properties +++ b/samples/client/petstore/java/webclient-nulable-arrays/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradlew b/samples/client/petstore/java/webclient-nulable-arrays/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/gradlew +++ b/samples/client/petstore/java/webclient-nulable-arrays/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat b/samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat +++ b/samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index a334fd7f801..f0b09f82401 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-webclient:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-webclient' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-webclient' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-webclient:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/webclient/gradle.properties b/samples/client/petstore/java/webclient/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/client/petstore/java/webclient/gradle.properties +++ b/samples/client/petstore/java/webclient/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/webclient/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/webclient/gradlew b/samples/client/petstore/java/webclient/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/client/petstore/java/webclient/gradlew +++ b/samples/client/petstore/java/webclient/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/webclient/gradlew.bat b/samples/client/petstore/java/webclient/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/client/petstore/java/webclient/gradlew.bat +++ b/samples/client/petstore/java/webclient/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/client/petstore/spring-cloud-no-nullable/.openapi-generator-ignore b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/spring-cloud-no-nullable/.openapi-generator-ignore rename to samples/client/petstore/kotlin-enum-default-value/.openapi-generator-ignore diff --git a/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES new file mode 100644 index 00000000000..bb98f9a0031 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES @@ -0,0 +1,27 @@ +README.md +build.gradle +docs/DefaultApi.md +docs/ModelWithEnumPropertyHavingDefault.md +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle +src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt diff --git a/samples/client/petstore/spring-cloud-no-nullable/.openapi-generator/VERSION b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/spring-cloud-no-nullable/.openapi-generator/VERSION rename to samples/client/petstore/kotlin-enum-default-value/.openapi-generator/VERSION diff --git a/samples/client/petstore/kotlin-enum-default-value/README.md b/samples/client/petstore/kotlin-enum-default-value/README.md new file mode 100644 index 00000000000..57d63266ef2 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/README.md @@ -0,0 +1,50 @@ +# org.openapitools.client - Kotlin client library for Issue 10591 Enum default value + +## Requires + +* Kotlin 1.4.30 +* Gradle 6.8.3 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**operation**](docs/DefaultApi.md#operation) | **GET** / | + + + +## Documentation for Models + + - [org.openapitools.client.models.ModelWithEnumPropertyHavingDefault](docs/ModelWithEnumPropertyHavingDefault.md) + + + +## Documentation for Authorization + +All endpoints do not require authorization. diff --git a/samples/client/petstore/kotlin-enum-default-value/build.gradle b/samples/client/petstore/kotlin-enum-default-value/build.gradle new file mode 100644 index 00000000000..3de8b45b135 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/build.gradle @@ -0,0 +1,37 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '6.8.3' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '1.5.10' + + repositories { + maven { url "https://repo1.maven.org/maven2" } + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + maven { url "https://repo1.maven.org/maven2" } +} + +test { + useJUnitPlatform() +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.moshi:moshi-adapters:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" +} diff --git a/samples/client/petstore/kotlin-enum-default-value/docs/DefaultApi.md b/samples/client/petstore/kotlin-enum-default-value/docs/DefaultApi.md new file mode 100644 index 00000000000..958931d0aba --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/docs/DefaultApi.md @@ -0,0 +1,50 @@ +# DefaultApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**operation**](DefaultApi.md#operation) | **GET** / | + + + +# **operation** +> ModelWithEnumPropertyHavingDefault operation() + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = DefaultApi() +try { + val result : ModelWithEnumPropertyHavingDefault = apiInstance.operation() + println(result) +} catch (e: ClientException) { + println("4xx response calling DefaultApi#operation") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling DefaultApi#operation") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**ModelWithEnumPropertyHavingDefault**](ModelWithEnumPropertyHavingDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + diff --git a/samples/client/petstore/kotlin-enum-default-value/docs/ModelWithEnumPropertyHavingDefault.md b/samples/client/petstore/kotlin-enum-default-value/docs/ModelWithEnumPropertyHavingDefault.md new file mode 100644 index 00000000000..363543468fe --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/docs/ModelWithEnumPropertyHavingDefault.md @@ -0,0 +1,17 @@ + +# ModelWithEnumPropertyHavingDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyName** | [**inline**](#PropertyName) | | + + + +## Enum: propertyName +Name | Value +---- | ----- +propertyName | VALUE + + + diff --git a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..e708b1c023e Binary files /dev/null and b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..8cf6eb5ad22 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/petstore/kotlin-enum-default-value/gradlew b/samples/client/petstore/kotlin-enum-default-value/gradlew new file mode 100644 index 00000000000..4f906e0c811 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/kotlin-enum-default-value/gradlew.bat b/samples/client/petstore/kotlin-enum-default-value/gradlew.bat new file mode 100644 index 00000000000..107acd32c4e --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/kotlin-enum-default-value/settings.gradle b/samples/client/petstore/kotlin-enum-default-value/settings.gradle new file mode 100644 index 00000000000..847312cb600 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/settings.gradle @@ -0,0 +1,2 @@ + +rootProject.name = 'kotlin-enum-default-value' \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt new file mode 100644 index 00000000000..48829a1408e --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -0,0 +1,96 @@ +/** + * Issue 10591 Enum default value + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: latest + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.apis + +import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + } + } + + /** + * + * + * @return ModelWithEnumPropertyHavingDefault + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun operation() : ModelWithEnumPropertyHavingDefault { + val localVariableConfig = operationRequestConfig() + + val localVarResponse = request( + localVariableConfig + ) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelWithEnumPropertyHavingDefault + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * To obtain the request config of the operation operation + * + * @return RequestConfig + */ + fun operationRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + + return RequestConfig( + method = RequestMethod.GET, + path = "/", + query = localVariableQuery, + headers = localVariableHeaders, + body = localVariableBody + ) + } + +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 00000000000..ef7a8f1e1a6 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 00000000000..c5dc803570a --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,245 @@ +package org.openapitools.client.infrastructure + +import okhttp3.OkHttpClient +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.FormBody +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.ResponseBody +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.Request +import okhttp3.Headers +import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST +import java.io.BufferedWriter +import java.io.File +import java.io.FileWriter +import java.io.IOException +import java.net.URLConnection +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.OffsetDateTime +import java.time.OffsetTime +import java.util.Date +import java.util.Locale +import com.squareup.moshi.adapter + +open class ApiClient(val baseUrl: String) { + companion object { + protected const val ContentType = "Content-Type" + protected const val Accept = "Accept" + protected const val Authorization = "Authorization" + protected const val JsonMediaType = "application/json" + protected const val FormDataMediaType = "multipart/form-data" + protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" + protected const val XmlMediaType = "application/xml" + + val apiKey: MutableMap = mutableMapOf() + val apiKeyPrefix: MutableMap = mutableMapOf() + var username: String? = null + var password: String? = null + var accessToken: String? = null + + @JvmStatic + val client: OkHttpClient by lazy { + builder.build() + } + + @JvmStatic + val builder: OkHttpClient.Builder = OkHttpClient.Builder() + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + protected fun guessContentTypeFromFile(file: File): String { + val contentType = URLConnection.guessContentTypeFromName(file.name) + return contentType ?: "application/octet-stream" + } + + protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + when { + content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) + mediaType == FormDataMediaType -> { + MultipartBody.Builder() + .setType(MultipartBody.FORM) + .apply { + // content's type *must* be Map + @Suppress("UNCHECKED_CAST") + (content as Map).forEach { (key, value) -> + if (value is File) { + val partHeaders = Headers.headersOf( + "Content-Disposition", + "form-data; name=\"$key\"; filename=\"${value.name}\"" + ) + val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() + addPart(partHeaders, value.asRequestBody(fileMediaType)) + } else { + val partHeaders = Headers.headersOf( + "Content-Disposition", + "form-data; name=\"$key\"" + ) + addPart( + partHeaders, + parameterToString(value).toRequestBody(null) + ) + } + } + }.build() + } + mediaType == FormUrlEncMediaType -> { + FormBody.Builder().apply { + // content's type *must* be Map + @Suppress("UNCHECKED_CAST") + (content as Map).forEach { (key, value) -> + add(key, parameterToString(value)) + } + }.build() + } + mediaType == JsonMediaType -> { + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody( + mediaType.toMediaTypeOrNull() + ) + } + } + mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") + // TODO: this should be extended with other serializers + else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") + } + + @OptIn(ExperimentalStdlibApi::class) + protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { + if(body == null) { + return null + } + val bodyContent = body.string() + if (bodyContent.isEmpty()) { + return null + } + if (T::class.java == File::class.java) { + // return tempfile + val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + f.deleteOnExit() + val out = BufferedWriter(FileWriter(f)) + out.write(bodyContent) + out.close() + return f as T + } + return when(mediaType) { + JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") + } + } + + + protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") + + val url = httpUrl.newBuilder() + .addPathSegments(requestConfig.path.trimStart('/')) + .apply { + requestConfig.query.forEach { query -> + query.value.forEach { queryValue -> + addQueryParameter(query.key, queryValue) + } + } + }.build() + + // take content-type/accept from spec or set to default (application/json) if not defined + if (requestConfig.headers[ContentType].isNullOrEmpty()) { + requestConfig.headers[ContentType] = JsonMediaType + } + if (requestConfig.headers[Accept].isNullOrEmpty()) { + requestConfig.headers[Accept] = JsonMediaType + } + val headers = requestConfig.headers + + if(headers[ContentType] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") + } + + if(headers[Accept] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Accept header. This is required.") + } + + // TODO: support multiple contentType options here. + val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + + val request = when (requestConfig.method) { + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) + RequestMethod.GET -> Request.Builder().url(url) + RequestMethod.HEAD -> Request.Builder().url(url).head() + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) + RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) + }.apply { + headers.forEach { header -> addHeader(header.key, header.value) } + }.build() + + val response = client.newCall(request).execute() + + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) + + // TODO: handle specific mapping types. e.g. Map> + return when { + response.isRedirect -> Redirection( + response.code, + response.headers.toMultimap() + ) + response.isInformational -> Informational( + response.message, + response.code, + response.headers.toMultimap() + ) + response.isSuccessful -> Success( + responseBody(response.body, accept), + response.code, + response.headers.toMultimap() + ) + response.isClientError -> ClientError( + response.message, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + else -> ServerError( + response.message, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + } + } + + protected fun parameterToString(value: Any?): String = when (value) { + null -> "" + is Array<*> -> toMultiValue(value, "csv").toString() + is Iterable<*> -> toMultiValue(value, "csv").toString() + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + parseDateToQueryString(value) + else -> value.toString() + } + + protected inline fun parseDateToQueryString(value : T): String { + /* + .replace("\"", "") converts the json object string to an actual string for the query parameter. + The moshi or gson adapter allows a more generic solution instead of trying to use a native + formatter. It also easily allows to provide a simple way to define a custom date format pattern + inside a gson/moshi adapter. + */ + return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") + } +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt new file mode 100644 index 00000000000..9dc8d8dbbfa --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiInfrastructureResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt new file mode 100644 index 00000000000..fb2c972cf8d --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigDecimal + +class BigDecimalAdapter { + @ToJson + fun toJson(value: BigDecimal): String { + return value.toPlainString() + } + + @FromJson + fun fromJson(value: String): BigDecimal { + return BigDecimal(value) + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt new file mode 100644 index 00000000000..4b6963110c9 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigInteger + +class BigIntegerAdapter { + @ToJson + fun toJson(value: BigInteger): String { + return value.toString() + } + + @FromJson + fun fromJson(value: String): BigInteger { + return BigInteger(value) + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt new file mode 100644 index 00000000000..ff5e2a81ee8 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -0,0 +1,12 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson + +class ByteArrayAdapter { + @ToJson + fun toJson(data: ByteArray): String = String(data) + + @FromJson + fun fromJson(data: String): ByteArray = data.toByteArray() +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt new file mode 100644 index 00000000000..b5310e71f13 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -0,0 +1,18 @@ +@file:Suppress("unused") +package org.openapitools.client.infrastructure + +import java.lang.RuntimeException + +open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 123L + } +} + +open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 456L + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt new file mode 100644 index 00000000000..b2e1654479a --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class LocalDateAdapter { + @ToJson + fun toJson(value: LocalDate): String { + return DateTimeFormatter.ISO_LOCAL_DATE.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDate { + return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) + } + +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 00000000000..e082db94811 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +class LocalDateTimeAdapter { + @ToJson + fun toJson(value: LocalDateTime): String { + return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDateTime { + return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } + +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt new file mode 100644 index 00000000000..87437871a31 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter + +class OffsetDateTimeAdapter { + @ToJson + fun toJson(value: OffsetDateTime): String { + return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): OffsetDateTime { + return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) + } + +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 00000000000..7e948e1dd07 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val body: T? = null +) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 00000000000..931b12b8bd7 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt new file mode 100644 index 00000000000..9bd2790dc14 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -0,0 +1,24 @@ +package org.openapitools.client.infrastructure + +import okhttp3.Response + +/** + * Provides an extension to evaluation whether the response is a 1xx code + */ +val Response.isInformational : Boolean get() = this.code in 100..199 + +/** + * Provides an extension to evaluation whether the response is a 3xx code + */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") +val Response.isRedirect : Boolean get() = this.code in 300..399 + +/** + * Provides an extension to evaluation whether the response is a 4xx code + */ +val Response.isClientError : Boolean get() = this.code in 400..499 + +/** + * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code + */ +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 00000000000..e22592e47d7 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory + +object Serializer { + @JvmStatic + val moshiBuilder: Moshi.Builder = Moshi.Builder() + .add(OffsetDateTimeAdapter()) + .add(LocalDateTimeAdapter()) + .add(LocalDateAdapter()) + .add(UUIDAdapter()) + .add(ByteArrayAdapter()) + .add(URIAdapter()) + .add(KotlinJsonAdapterFactory()) + .add(BigDecimalAdapter()) + .add(BigIntegerAdapter()) + + @JvmStatic + val moshi: Moshi by lazy { + moshiBuilder.build() + } +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt new file mode 100644 index 00000000000..927522757da --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.net.URI + +class URIAdapter { + @ToJson + fun toJson(uri: URI) = uri.toString() + + @FromJson + fun fromJson(s: String): URI = URI.create(s) +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt new file mode 100644 index 00000000000..7ccf7dc25d2 --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.util.UUID + +class UUIDAdapter { + @ToJson + fun toJson(uuid: UUID) = uuid.toString() + + @FromJson + fun fromJson(s: String): UUID = UUID.fromString(s) +} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt new file mode 100644 index 00000000000..80f0176dc0c --- /dev/null +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt @@ -0,0 +1,52 @@ +/** + * Issue 10591 Enum default value + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: latest + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import java.io.Serializable + +/** + * + * + * @param propertyName + */ + +data class ModelWithEnumPropertyHavingDefault ( + + @Json(name = "propertyName") + val propertyName: ModelWithEnumPropertyHavingDefault.PropertyName = PropertyName.vALUE + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + /** + * + * + * Values: vALUE + */ + enum class PropertyName(val value: kotlin.String) { + @Json(name = "VALUE") vALUE("VALUE"); + } +} + diff --git a/samples/client/petstore/kotlin-gson/docs/Order.md b/samples/client/petstore/kotlin-gson/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-gson/docs/Order.md +++ b/samples/client/petstore/kotlin-gson/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-gson/docs/Pet.md b/samples/client/petstore/kotlin-gson/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-gson/docs/Pet.md +++ b/samples/client/petstore/kotlin-gson/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jackson/docs/Order.md b/samples/client/petstore/kotlin-jackson/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-jackson/docs/Order.md +++ b/samples/client/petstore/kotlin-jackson/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jackson/docs/Pet.md b/samples/client/petstore/kotlin-jackson/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-jackson/docs/Pet.md +++ b/samples/client/petstore/kotlin-jackson/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-json-request-string/docs/Order.md b/samples/client/petstore/kotlin-json-request-string/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/Order.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-json-request-string/docs/Pet.md b/samples/client/petstore/kotlin-json-request-string/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/Pet.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md b/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md b/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-multiplatform/docs/Order.md b/samples/client/petstore/kotlin-multiplatform/docs/Order.md index 4683c14c1cb..6105916fc11 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/Order.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | **kotlin.String** | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-multiplatform/docs/Pet.md b/samples/client/petstore/kotlin-multiplatform/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/Pet.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties index 6ce793f21e8..a40165ee36c 100644 --- a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Sep 24 10:59:07 CEST 2021 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt index 5f0a52c1951..40276dbb985 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt @@ -7,7 +7,7 @@ class HttpBasicAuth : Authentication { var username: String? = null var password: String? = null - @InternalAPI + @OptIn(InternalAPI::class) override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Order.md b/samples/client/petstore/kotlin-nonpublic/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/Order.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Pet.md b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/Pet.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nullable/docs/Order.md b/samples/client/petstore/kotlin-nullable/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-nullable/docs/Order.md +++ b/samples/client/petstore/kotlin-nullable/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nullable/docs/Pet.md b/samples/client/petstore/kotlin-nullable/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-nullable/docs/Pet.md +++ b/samples/client/petstore/kotlin-nullable/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-okhttp3/docs/Order.md b/samples/client/petstore/kotlin-okhttp3/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/Order.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-okhttp3/docs/Pet.md b/samples/client/petstore/kotlin-okhttp3/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/Pet.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Order.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Order.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Pet.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Pet.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2/docs/Order.md b/samples/client/petstore/kotlin-retrofit2/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/Order.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2/docs/Pet.md b/samples/client/petstore/kotlin-retrofit2/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/Pet.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-string/docs/Order.md b/samples/client/petstore/kotlin-string/docs/Order.md index 4683c14c1cb..6105916fc11 100644 --- a/samples/client/petstore/kotlin-string/docs/Order.md +++ b/samples/client/petstore/kotlin-string/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | **kotlin.String** | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-string/docs/Pet.md b/samples/client/petstore/kotlin-string/docs/Pet.md index 73963abeb04..bda418cbf65 100644 --- a/samples/client/petstore/kotlin-string/docs/Pet.md +++ b/samples/client/petstore/kotlin-string/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **name** | **kotlin.String** | | **photoUrls** | **kotlin.collections.List<kotlin.String>** | | **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-threetenbp/docs/Order.md b/samples/client/petstore/kotlin-threetenbp/docs/Order.md index 776e0ddc2f0..aba9a5d0d1b 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/Order.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**org.threeten.bp.OffsetDateTime**](org.threeten.bp.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-threetenbp/docs/Pet.md b/samples/client/petstore/kotlin-threetenbp/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/Pet.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin/docs/Order.md b/samples/client/petstore/kotlin/docs/Order.md index 5112f08958d..94ab0d537e5 100644 --- a/samples/client/petstore/kotlin/docs/Order.md +++ b/samples/client/petstore/kotlin/docs/Order.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **petId** | **kotlin.Long** | | [optional] **quantity** | **kotlin.Int** | | [optional] **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**status** | [**inline**](#Status) | Order Status | [optional] **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin/docs/Pet.md b/samples/client/petstore/kotlin/docs/Pet.md index c82844b5ee8..bc3dd89718f 100644 --- a/samples/client/petstore/kotlin/docs/Pet.md +++ b/samples/client/petstore/kotlin/docs/Pet.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **kotlin.Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +**status** | [**inline**](#Status) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 63a8fef63e7..d884b222adb 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -22,7 +22,8 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2" + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^2.0" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 279e7b6ab16..62f9f163e07 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -157,6 +158,13 @@ class AnotherFakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -351,7 +359,7 @@ class AnotherFakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -367,7 +375,7 @@ class AnotherFakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index f4429cfec02..8d912d914d6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -151,6 +152,13 @@ class DefaultApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -326,7 +334,7 @@ class DefaultApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -342,7 +350,7 @@ class DefaultApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index b9132ea5d94..b9ccd0b51a1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -155,6 +156,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -334,7 +342,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -350,7 +358,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -405,6 +413,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -576,7 +591,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -592,7 +607,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -640,6 +655,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -824,7 +846,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -840,7 +862,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -888,6 +910,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1072,7 +1101,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1088,7 +1117,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1136,6 +1165,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1320,7 +1356,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1336,7 +1372,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1384,6 +1420,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1568,7 +1611,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1584,7 +1627,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1632,6 +1675,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1822,7 +1872,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1838,7 +1888,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1885,6 +1935,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2031,7 +2088,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2047,7 +2104,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -2094,6 +2151,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2240,7 +2304,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2256,7 +2320,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -2305,6 +2369,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2471,7 +2542,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2487,7 +2558,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -2539,6 +2610,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2733,7 +2811,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2749,7 +2827,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -2826,6 +2904,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -3083,7 +3168,7 @@ class FakeApi $formParams['binary'] = []; $paramFiles = is_array($binary) ? $binary : [$binary]; foreach ($paramFiles as $paramFile) { - $formParams['binary'][] = \GuzzleHttp\Psr7\try_fopen( + $formParams['binary'][] = \GuzzleHttp\Psr7\Utils::tryFopen( ObjectSerializer::toFormValue($paramFile), 'rb' ); @@ -3138,7 +3223,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -3158,7 +3243,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -3223,6 +3308,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -3445,7 +3537,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -3461,7 +3553,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -3526,6 +3618,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -3763,7 +3862,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -3783,7 +3882,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -3834,6 +3933,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -3984,7 +4090,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -4000,7 +4106,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -4053,6 +4159,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -4214,7 +4327,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -4230,7 +4343,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -4289,6 +4402,13 @@ class FakeApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -4538,7 +4658,7 @@ class FakeApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -4554,7 +4674,7 @@ class FakeApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 289c6a1aed1..611b7d5bba0 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -157,6 +158,13 @@ class FakeClassnameTags123Api $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -351,7 +359,7 @@ class FakeClassnameTags123Api } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -372,7 +380,7 @@ class FakeClassnameTags123Api $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index d12895f0b3d..e82200611e6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -164,6 +165,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -326,7 +334,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -352,7 +360,7 @@ class PetApi } $operationHost = $operationHosts[$this->hostIndex]; - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), @@ -405,6 +413,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -564,7 +579,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -584,7 +599,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -636,6 +651,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -831,7 +853,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -851,7 +873,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -905,6 +927,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1104,7 +1133,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1124,7 +1153,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1176,6 +1205,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1372,7 +1408,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1393,7 +1429,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1452,6 +1488,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1614,7 +1657,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1640,7 +1683,7 @@ class PetApi } $operationHost = $operationHosts[$this->hostIndex]; - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), @@ -1695,6 +1738,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1861,7 +1911,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1881,7 +1931,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1937,6 +1987,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2116,7 +2173,7 @@ class PetApi $formParams['file'] = []; $paramFiles = is_array($file) ? $file : [$file]; foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\try_fopen( + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( ObjectSerializer::toFormValue($paramFile), 'rb' ); @@ -2155,7 +2212,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2175,7 +2232,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -2231,6 +2288,13 @@ class PetApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -2416,7 +2480,7 @@ class PetApi $formParams['requiredFile'] = []; $paramFiles = is_array($required_file) ? $required_file : [$required_file]; foreach ($paramFiles as $paramFile) { - $formParams['requiredFile'][] = \GuzzleHttp\Psr7\try_fopen( + $formParams['requiredFile'][] = \GuzzleHttp\Psr7\Utils::tryFopen( ObjectSerializer::toFormValue($paramFile), 'rb' ); @@ -2455,7 +2519,7 @@ class PetApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2475,7 +2539,7 @@ class PetApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 86eec2446cc..cb3fc4d2f36 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -156,6 +157,13 @@ class StoreApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -308,7 +316,7 @@ class StoreApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -324,7 +332,7 @@ class StoreApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -374,6 +382,13 @@ class StoreApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -553,7 +568,7 @@ class StoreApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -574,7 +589,7 @@ class StoreApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -626,6 +641,13 @@ class StoreApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -829,7 +851,7 @@ class StoreApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -845,7 +867,7 @@ class StoreApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -897,6 +919,13 @@ class StoreApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1091,7 +1120,7 @@ class StoreApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1107,7 +1136,7 @@ class StoreApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 44af651832e..f1e8fbe811f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -30,6 +30,7 @@ namespace OpenAPI\Client\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; @@ -156,6 +157,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -306,7 +314,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -322,7 +330,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -373,6 +381,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -523,7 +538,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -539,7 +554,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -590,6 +605,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -740,7 +762,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -756,7 +778,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -807,6 +829,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -959,7 +988,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -975,7 +1004,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1027,6 +1056,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1223,7 +1259,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1239,7 +1275,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1293,6 +1329,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1512,7 +1555,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1528,7 +1571,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1577,6 +1620,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1712,7 +1762,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1728,7 +1778,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1781,6 +1831,13 @@ class UserApi $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); } $statusCode = $response->getStatusCode(); @@ -1948,7 +2005,7 @@ class UserApi } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1964,7 +2021,7 @@ class UserApi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 11488afc0c2..b86bcfbed63 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -305,6 +305,9 @@ class ObjectSerializer if ($class === 'object') { settype($data, 'array'); return $data; + } else if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; } if ($class === '\DateTime') { diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/FakeHttpClient.php b/samples/client/petstore/php/OpenAPIClient-php/tests/FakeHttpClient.php index d93b8f8b0b3..f5e32d4c659 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/FakeHttpClient.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/FakeHttpClient.php @@ -4,6 +4,7 @@ namespace OpenAPI\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Psr7\Response; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -41,23 +42,23 @@ class FakeHttpClient implements ClientInterface * @return ResponseInterface * @throws GuzzleException */ - public function send(RequestInterface $request, array $options = []) + public function send(RequestInterface $request, array $options = []): ResponseInterface { $this->request = $request; return $this->response ?: new Response(200); } - public function sendAsync(RequestInterface $request, array $options = []) + public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface { throw new \RuntimeException('not implemented'); } - public function request($method, $uri, array $options = []) + public function request($method, $uri, array $options = []): ResponseInterface { throw new \RuntimeException('not implemented'); } - public function requestAsync($method, $uri, array $options = []) + public function requestAsync($method, $uri, array $options = []): PromiseInterface { throw new \RuntimeException('not implemented'); } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index 3c8195b154d..ca9c48d6881 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -56,7 +56,7 @@ module Petstore } connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| - conn.basic_auth(config.username, config.password) + conn.request(:basic_auth, config.username, config.password) @config.configure_middleware(conn) if opts[:header_params]["Content-Type"] == "multipart/form-data" conn.request :multipart diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala index fe391096713..74575e12cdd 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/ApiInvoker.scala @@ -182,7 +182,7 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomC case Some(c: String) => HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(c))) case _ => - HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(" "))) + HttpRequest(m, uri, entity = HttpEntity(normalizedContentType(request.contentType), ByteString(""))) } case m: HttpMethod => HttpRequest(m, uri) } diff --git a/samples/client/petstore/spring-cloud-async/pom.xml b/samples/client/petstore/spring-cloud-async/pom.xml index df73895bb1b..254a8357fce 100644 --- a/samples/client/petstore/spring-cloud-async/pom.xml +++ b/samples/client/petstore/spring-cloud-async/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.5.5 src/main/java @@ -25,7 +25,7 @@ org.springframework.cloud spring-cloud-starter-parent - Finchley.SR1 + 2020.0.4 pom import @@ -51,6 +51,7 @@ org.springframework.cloud spring-cloud-starter-oauth2 + 2.2.5.RELEASE com.fasterxml.jackson.datatype @@ -59,7 +60,7 @@ org.openapitools jackson-databind-nullable - 0.1.0 + 0.2.1 org.springframework.boot @@ -74,7 +75,7 @@ io.springfox springfox-swagger2 - 2.8.0 + 3.0.0 org.springframework.data diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 8f503c9cf22..4a28661290d 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; +import org.springframework.cloud.openfeign.security.OAuth2FeignRequestInterceptor; import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; import org.springframework.security.oauth2.client.OAuth2ClientContext; import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitResourceDetails; diff --git a/samples/client/petstore/spring-cloud-no-nullable/.openapi-generator/FILES b/samples/client/petstore/spring-cloud-no-nullable/.openapi-generator/FILES deleted file mode 100644 index 3510d2b2d27..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/.openapi-generator/FILES +++ /dev/null @@ -1,16 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/api/PetApi.java -src/main/java/org/openapitools/api/PetApiClient.java -src/main/java/org/openapitools/api/StoreApi.java -src/main/java/org/openapitools/api/StoreApiClient.java -src/main/java/org/openapitools/api/UserApi.java -src/main/java/org/openapitools/api/UserApiClient.java -src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java -src/main/java/org/openapitools/configuration/ClientConfiguration.java -src/main/java/org/openapitools/model/Category.java -src/main/java/org/openapitools/model/ModelApiResponse.java -src/main/java/org/openapitools/model/Order.java -src/main/java/org/openapitools/model/Pet.java -src/main/java/org/openapitools/model/Tag.java -src/main/java/org/openapitools/model/User.java diff --git a/samples/client/petstore/spring-cloud-no-nullable/README.md b/samples/client/petstore/spring-cloud-no-nullable/README.md deleted file mode 100644 index f27244a8e57..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# petstore-spring-cloud-no-nullable - -## Requirements - -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn deploy -``` - -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - org.openapitools - petstore-spring-cloud-no-nullable - 1.0.0 - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy -compile "org.openapitools:petstore-spring-cloud-no-nullable:1.0.0" -``` - -### Others - -At first generate the JAR by executing: - -mvn package - -Then manually install the following JARs: - -* target/petstore-spring-cloud-no-nullable-1.0.0.jar -* target/lib/*.jar diff --git a/samples/client/petstore/spring-cloud-no-nullable/pom.xml b/samples/client/petstore/spring-cloud-no-nullable/pom.xml deleted file mode 100644 index 9b0d32ab807..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - org.openapitools - petstore-spring-cloud-no-nullable - jar - petstore-spring-cloud-no-nullable - 1.0.0 - - 1.8 - ${java.version} - ${java.version} - 1.5.18 - - - org.springframework.boot - spring-boot-starter-parent - 2.0.5.RELEASE - - - src/main/java - - - - - - org.springframework.cloud - spring-cloud-starter-parent - Finchley.SR1 - pom - import - - - - - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - org.springframework.cloud - spring-cloud-starter-oauth2 - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - org.springframework.boot - spring-boot-starter-test - test - - - org.hibernate.validator - hibernate-validator - 6.0.16.Final - - - io.springfox - springfox-swagger2 - 2.8.0 - - - org.springframework.data - spring-data-commons - - - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApi.java deleted file mode 100644 index 7d066bfdc0e..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApi.java +++ /dev/null @@ -1,216 +0,0 @@ -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.openapitools.model.ModelApiResponse; -import org.openapitools.model.Pet; -import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -@Validated -@Api(value = "Pet", description = "the Pet API") -public interface PetApi { - - /** - * POST /pet : Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid input (status code 405) - */ - @ApiOperation(value = "Add a new pet to the store", nickname = "addPet", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/pet", - consumes = "application/json" - ) - com.netflix.hystrix.HystrixCommand> addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body); - - - /** - * DELETE /pet/{petId} : Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @return Invalid pet value (status code 400) - */ - @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid pet value") }) - @RequestMapping( - method = RequestMethod.DELETE, - value = "/pet/{petId}" - ) - com.netflix.hystrix.HystrixCommand> deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) String apiKey); - - - /** - * GET /pet/findByStatus : Finds Pets by status - * Multiple status values can be provided with comma separated strings - * - * @param status Status values that need to be considered for filter (required) - * @return successful operation (status code 200) - * or Invalid status value (status code 400) - */ - @ApiOperation(value = "Finds Pets by status", nickname = "findPetsByStatus", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - @ApiResponse(code = 400, message = "Invalid status value") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/pet/findByStatus", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List status); - - - /** - * GET /pet/findByTags : Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @param tags Tags to filter by (required) - * @return successful operation (status code 200) - * or Invalid tag value (status code 400) - * @deprecated - */ - @ApiOperation(value = "Finds Pets by tags", nickname = "findPetsByTags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - @ApiResponse(code = 400, message = "Invalid tag value") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/pet/findByTags", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); - - - /** - * GET /pet/{petId} : Find pet by ID - * Returns a single pet - * - * @param petId ID of pet to return (required) - * @return successful operation (status code 200) - * or Invalid ID supplied (status code 400) - * or Pet not found (status code 404) - */ - @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { - - @Authorization(value = "api_key") - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Pet.class), - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/pet/{petId}", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand> getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId); - - - /** - * PUT /pet : Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid ID supplied (status code 400) - * or Pet not found (status code 404) - * or Validation exception (status code 405) - */ - @ApiOperation(value = "Update an existing pet", nickname = "updatePet", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Pet not found"), - @ApiResponse(code = 405, message = "Validation exception") }) - @RequestMapping( - method = RequestMethod.PUT, - value = "/pet", - consumes = "application/json" - ) - com.netflix.hystrix.HystrixCommand> updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body); - - - /** - * POST /pet/{petId} : Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return Invalid input (status code 405) - */ - @ApiOperation(value = "Updates a pet in the store with form data", nickname = "updatePetWithForm", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/pet/{petId}", - consumes = "application/x-www-form-urlencoded" - ) - com.netflix.hystrix.HystrixCommand> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestParam(value="status", required=false) String status); - - - /** - * POST /pet/{petId}/uploadImage : uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return successful operation (status code 200) - */ - @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping( - method = RequestMethod.POST, - value = "/pet/{petId}/uploadImage", - produces = "application/json", - consumes = "multipart/form-data" - ) - com.netflix.hystrix.HystrixCommand> uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @RequestParam("file") MultipartFile file); - -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApiClient.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApiClient.java deleted file mode 100644 index f80fe4ddc67..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/PetApiClient.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.api; - -import org.springframework.cloud.openfeign.FeignClient; -import org.openapitools.configuration.ClientConfiguration; - -@FeignClient(name="${pet.name:pet}", url="${pet.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) -public interface PetApiClient extends PetApi { -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApi.java deleted file mode 100644 index f2f083a51f1..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApi.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import java.util.Map; -import org.openapitools.model.Order; -import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -@Validated -@Api(value = "Store", description = "the Store API") -public interface StoreApi { - - /** - * DELETE /store/order/{orderId} : Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @param orderId ID of the order that needs to be deleted (required) - * @return Invalid ID supplied (status code 400) - * or Order not found (status code 404) - */ - @ApiOperation(value = "Delete purchase order by ID", nickname = "deleteOrder", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping( - method = RequestMethod.DELETE, - value = "/store/order/{orderId}" - ) - com.netflix.hystrix.HystrixCommand> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") String orderId); - - - /** - * GET /store/inventory : Returns pet inventories by status - * Returns a map of status codes to quantities - * - * @return successful operation (status code 200) - */ - @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { - - @Authorization(value = "api_key") - }, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/store/inventory", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand>> getInventory(); - - - /** - * GET /store/order/{orderId} : Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @param orderId ID of pet that needs to be fetched (required) - * @return successful operation (status code 200) - * or Invalid ID supplied (status code 400) - * or Order not found (status code 404) - */ - @ApiOperation(value = "Find purchase order by ID", nickname = "getOrderById", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Order.class), - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/store/order/{orderId}", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId); - - - /** - * POST /store/order : Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return successful operation (status code 200) - * or Invalid Order (status code 400) - */ - @ApiOperation(value = "Place an order for a pet", nickname = "placeOrder", notes = "", response = Order.class, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Order.class), - @ApiResponse(code = 400, message = "Invalid Order") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/store/order", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand> placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order body); - -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApiClient.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApiClient.java deleted file mode 100644 index 71d613a871d..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/StoreApiClient.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.api; - -import org.springframework.cloud.openfeign.FeignClient; -import org.openapitools.configuration.ClientConfiguration; - -@FeignClient(name="${store.name:store}", url="${store.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) -public interface StoreApiClient extends StoreApi { -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApi.java deleted file mode 100644 index b6bb22edb83..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApi.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import java.util.List; -import org.openapitools.model.User; -import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -@Validated -@Api(value = "User", description = "the User API") -public interface UserApi { - - /** - * POST /user : Create user - * This can only be done by the logged in user. - * - * @param body Created user object (required) - * @return successful operation (status code 200) - */ - @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/user" - ) - com.netflix.hystrix.HystrixCommand> createUser(@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User body); - - - /** - * POST /user/createWithArray : Creates list of users with given input array - * - * @param body List of user object (required) - * @return successful operation (status code 200) - */ - @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/user/createWithArray" - ) - com.netflix.hystrix.HystrixCommand> createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List body); - - - /** - * POST /user/createWithList : Creates list of users with given input array - * - * @param body List of user object (required) - * @return successful operation (status code 200) - */ - @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping( - method = RequestMethod.POST, - value = "/user/createWithList" - ) - com.netflix.hystrix.HystrixCommand> createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List body); - - - /** - * DELETE /user/{username} : Delete user - * This can only be done by the logged in user. - * - * @param username The name that needs to be deleted (required) - * @return Invalid username supplied (status code 400) - * or User not found (status code 404) - */ - @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid username supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping( - method = RequestMethod.DELETE, - value = "/user/{username}" - ) - com.netflix.hystrix.HystrixCommand> deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username); - - - /** - * GET /user/{username} : Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return successful operation (status code 200) - * or Invalid username supplied (status code 400) - * or User not found (status code 404) - */ - @ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = User.class), - @ApiResponse(code = 400, message = "Invalid username supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/user/{username}", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username); - - - /** - * GET /user/login : Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return successful operation (status code 200) - * or Invalid username/password supplied (status code 400) - */ - @ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = String.class), - @ApiResponse(code = 400, message = "Invalid username/password supplied") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/user/login", - produces = "application/json" - ) - com.netflix.hystrix.HystrixCommand> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); - - - /** - * GET /user/logout : Logs out current logged in user session - * - * @return successful operation (status code 200) - */ - @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping( - method = RequestMethod.GET, - value = "/user/logout" - ) - com.netflix.hystrix.HystrixCommand> logoutUser(); - - - /** - * PUT /user/{username} : Updated user - * This can only be done by the logged in user. - * - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @return Invalid user supplied (status code 400) - * or User not found (status code 404) - */ - @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid user supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping( - method = RequestMethod.PUT, - value = "/user/{username}" - ) - com.netflix.hystrix.HystrixCommand> updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User body); - -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApiClient.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApiClient.java deleted file mode 100644 index 1db4598108d..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/api/UserApiClient.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.api; - -import org.springframework.cloud.openfeign.FeignClient; -import org.openapitools.configuration.ClientConfiguration; - -@FeignClient(name="${user.name:user}", url="${user.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) -public interface UserApiClient extends UserApi { -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java deleted file mode 100644 index 199278dcb53..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ApiKeyRequestInterceptor.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapitools.configuration; - -import feign.RequestInterceptor; -import feign.RequestTemplate; -import feign.Util; - - -public class ApiKeyRequestInterceptor implements RequestInterceptor { - private final String location; - private final String name; - private String value; - - public ApiKeyRequestInterceptor(String location, String name, String value) { - Util.checkNotNull(location, "location", new Object[0]); - Util.checkNotNull(name, "name", new Object[0]); - Util.checkNotNull(value, "value", new Object[0]); - this.location = location; - this.name = name; - this.value = value; - } - - @Override - public void apply(RequestTemplate requestTemplate) { - if(location.equals("header")) { - requestTemplate.header(name, value); - } else if(location.equals("query")) { - requestTemplate.query(name, value); - } - } - -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ClientConfiguration.java deleted file mode 100644 index 8f503c9cf22..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapitools.configuration; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; -import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; -import org.springframework.security.oauth2.client.OAuth2ClientContext; -import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitResourceDetails; - -@Configuration -@EnableConfigurationProperties -public class ClientConfiguration { - - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - - @Bean - @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") - public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { - return new OAuth2FeignRequestInterceptor(oAuth2ClientContext, petstoreAuthResourceDetails()); - } - - @Bean - @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") - public OAuth2ClientContext oAuth2ClientContext() { - return new DefaultOAuth2ClientContext(); - } - - @Bean - @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") - @ConfigurationProperties("openapipetstore.security.petstoreAuth") - public ImplicitResourceDetails petstoreAuthResourceDetails() { - ImplicitResourceDetails details = new ImplicitResourceDetails(); - details.setUserAuthorizationUri("http://petstore.swagger.io/api/oauth/dialog"); - return details; - } - -} diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Category.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Category.java deleted file mode 100644 index 2c765a51de9..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Category.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * A category for a pet - */ -@ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Category { - @JsonProperty("id") - private Long id; - - @JsonProperty("name") - private String name; - - public Category id(Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @ApiModelProperty(value = "") - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Category name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @ApiModelProperty(value = "") - - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/ModelApiResponse.java deleted file mode 100644 index 8f7cd51e26d..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/ModelApiResponse.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * Describes the result of uploading an image resource - */ -@ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class ModelApiResponse { - @JsonProperty("code") - private Integer code; - - @JsonProperty("type") - private String type; - - @JsonProperty("message") - private String message; - - public ModelApiResponse code(Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * @return code - */ - @ApiModelProperty(value = "") - - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public ModelApiResponse type(String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @ApiModelProperty(value = "") - - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public ModelApiResponse message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @ApiModelProperty(value = "") - - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Order.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Order.java deleted file mode 100644 index 9a420ed8679..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Order.java +++ /dev/null @@ -1,245 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * An order for a pets from the pet store - */ -@ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Order { - @JsonProperty("id") - private Long id; - - @JsonProperty("petId") - private Long petId; - - @JsonProperty("quantity") - private Integer quantity; - - @JsonProperty("shipDate") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime shipDate; - - /** - * Order Status - */ - public enum StatusEnum { - PLACED("placed"), - - APPROVED("approved"), - - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - - @JsonProperty("status") - private StatusEnum status; - - @JsonProperty("complete") - private Boolean complete = false; - - public Order id(Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @ApiModelProperty(value = "") - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Order petId(Long petId) { - this.petId = petId; - return this; - } - - /** - * Get petId - * @return petId - */ - @ApiModelProperty(value = "") - - - public Long getPetId() { - return petId; - } - - public void setPetId(Long petId) { - this.petId = petId; - } - - public Order quantity(Integer quantity) { - this.quantity = quantity; - return this; - } - - /** - * Get quantity - * @return quantity - */ - @ApiModelProperty(value = "") - - - public Integer getQuantity() { - return quantity; - } - - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - public Order shipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - return this; - } - - /** - * Get shipDate - * @return shipDate - */ - @ApiModelProperty(value = "") - - @Valid - - public OffsetDateTime getShipDate() { - return shipDate; - } - - public void setShipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - public Order status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Order Status - * @return status - */ - @ApiModelProperty(value = "Order Status") - - - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - public Order complete(Boolean complete) { - this.complete = complete; - return this; - } - - /** - * Get complete - * @return complete - */ - @ApiModelProperty(value = "") - - - public Boolean getComplete() { - return complete; - } - - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); - } - - @Override - public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); - sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); - sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Pet.java deleted file mode 100644 index b2fc9539454..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Pet.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.model.Category; -import org.openapitools.model.Tag; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * A pet for sale in the pet store - */ -@ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Pet { - @JsonProperty("id") - private Long id; - - @JsonProperty("category") - private Category category; - - @JsonProperty("name") - private String name; - - @JsonProperty("photoUrls") - @Valid - private List photoUrls = new ArrayList<>(); - - @JsonProperty("tags") - @Valid - private List tags = null; - - /** - * pet status in the store - */ - public enum StatusEnum { - AVAILABLE("available"), - - PENDING("pending"), - - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - - @JsonProperty("status") - private StatusEnum status; - - public Pet id(Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @ApiModelProperty(value = "") - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Pet category(Category category) { - this.category = category; - return this; - } - - /** - * Get category - * @return category - */ - @ApiModelProperty(value = "") - - @Valid - - public Category getCategory() { - return category; - } - - public void setCategory(Category category) { - this.category = category; - } - - public Pet name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull - - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Pet photoUrls(List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - public Pet addPhotoUrlsItem(String photoUrlsItem) { - if (this.photoUrls == null) { - this.photoUrls = new ArrayList<>(); - } - this.photoUrls.add(photoUrlsItem); - return this; - } - - /** - * Get photoUrls - * @return photoUrls - */ - @ApiModelProperty(required = true, value = "") - @NotNull - - - public List getPhotoUrls() { - return photoUrls; - } - - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - public Pet tags(List tags) { - this.tags = tags; - return this; - } - - public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * Get tags - * @return tags - */ - @ApiModelProperty(value = "") - - @Valid - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public Pet status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * pet status in the store - * @return status - */ - @ApiModelProperty(value = "pet status in the store") - - - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Tag.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Tag.java deleted file mode 100644 index 7938da997ad..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/Tag.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * A tag for a pet - */ -@ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Tag { - @JsonProperty("id") - private Long id; - - @JsonProperty("name") - private String name; - - public Tag id(Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @ApiModelProperty(value = "") - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Tag name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @ApiModelProperty(value = "") - - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/User.java b/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/User.java deleted file mode 100644 index d43bccdd77d..00000000000 --- a/samples/client/petstore/spring-cloud-no-nullable/src/main/java/org/openapitools/model/User.java +++ /dev/null @@ -1,254 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * A User who is purchasing from the pet store - */ -@ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class User { - @JsonProperty("id") - private Long id; - - @JsonProperty("username") - private String username; - - @JsonProperty("firstName") - private String firstName; - - @JsonProperty("lastName") - private String lastName; - - @JsonProperty("email") - private String email; - - @JsonProperty("password") - private String password; - - @JsonProperty("phone") - private String phone; - - @JsonProperty("userStatus") - private Integer userStatus; - - public User id(Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @ApiModelProperty(value = "") - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public User username(String username) { - this.username = username; - return this; - } - - /** - * Get username - * @return username - */ - @ApiModelProperty(value = "") - - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public User firstName(String firstName) { - this.firstName = firstName; - return this; - } - - /** - * Get firstName - * @return firstName - */ - @ApiModelProperty(value = "") - - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public User lastName(String lastName) { - this.lastName = lastName; - return this; - } - - /** - * Get lastName - * @return lastName - */ - @ApiModelProperty(value = "") - - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public User email(String email) { - this.email = email; - return this; - } - - /** - * Get email - * @return email - */ - @ApiModelProperty(value = "") - - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public User password(String password) { - this.password = password; - return this; - } - - /** - * Get password - * @return password - */ - @ApiModelProperty(value = "") - - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public User phone(String phone) { - this.phone = phone; - return this; - } - - /** - * Get phone - * @return phone - */ - @ApiModelProperty(value = "") - - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public User userStatus(Integer userStatus) { - this.userStatus = userStatus; - return this; - } - - /** - * User Status - * @return userStatus - */ - @ApiModelProperty(value = "User Status") - - - public Integer getUserStatus() { - return userStatus; - } - - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); - } - - @Override - public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); - sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/client/petstore/spring-cloud-spring-pageable/pom.xml b/samples/client/petstore/spring-cloud-spring-pageable/pom.xml index 4f6d81af452..4d47a486422 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/pom.xml +++ b/samples/client/petstore/spring-cloud-spring-pageable/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.5.5 src/main/java @@ -25,7 +25,7 @@ org.springframework.cloud spring-cloud-starter-parent - Finchley.SR1 + 2020.0.4 pom import @@ -51,6 +51,7 @@ org.springframework.cloud spring-cloud-starter-oauth2 + 2.2.5.RELEASE com.fasterxml.jackson.datatype @@ -59,7 +60,7 @@ org.openapitools jackson-databind-nullable - 0.1.0 + 0.2.1 org.springframework.boot @@ -74,7 +75,7 @@ io.springfox springfox-swagger2 - 2.8.0 + 3.0.0 org.springframework.data diff --git a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 8f503c9cf22..4a28661290d 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; +import org.springframework.cloud.openfeign.security.OAuth2FeignRequestInterceptor; import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; import org.springframework.security.oauth2.client.OAuth2ClientContext; import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitResourceDetails; diff --git a/samples/client/petstore/spring-cloud/pom.xml b/samples/client/petstore/spring-cloud/pom.xml index df73895bb1b..254a8357fce 100644 --- a/samples/client/petstore/spring-cloud/pom.xml +++ b/samples/client/petstore/spring-cloud/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.5.5 src/main/java @@ -25,7 +25,7 @@ org.springframework.cloud spring-cloud-starter-parent - Finchley.SR1 + 2020.0.4 pom import @@ -51,6 +51,7 @@ org.springframework.cloud spring-cloud-starter-oauth2 + 2.2.5.RELEASE com.fasterxml.jackson.datatype @@ -59,7 +60,7 @@ org.openapitools jackson-databind-nullable - 0.1.0 + 0.2.1 org.springframework.boot @@ -74,7 +75,7 @@ io.springfox springfox-swagger2 - 2.8.0 + 3.0.0 org.springframework.data diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java index 7d066bfdc0e..fd2b223f0b6 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApi.java @@ -29,22 +29,25 @@ public interface PetApi { /** * POST /pet : Add a new pet to the store * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid input (status code 405) + * @param pet Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid input (status code 405) */ - @ApiOperation(value = "Add a new pet to the store", nickname = "addPet", notes = "", authorizations = { + @ApiOperation(value = "Add a new pet to the store", nickname = "addPet", notes = "", response = Pet.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping( method = RequestMethod.POST, value = "/pet", + produces = "application/json", consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet); /** @@ -65,7 +68,7 @@ public interface PetApi { method = RequestMethod.DELETE, value = "/pet/{petId}" ) - com.netflix.hystrix.HystrixCommand> deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) String apiKey); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) String apiKey); /** @@ -78,7 +81,6 @@ public interface PetApi { */ @ApiOperation(value = "Finds Pets by status", nickname = "findPetsByStatus", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) @ApiResponses(value = { @@ -89,7 +91,7 @@ public interface PetApi { value = "/pet/findByStatus", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List status); + ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List status); /** @@ -103,7 +105,6 @@ public interface PetApi { */ @ApiOperation(value = "Finds Pets by tags", nickname = "findPetsByTags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) @ApiResponses(value = { @@ -114,7 +115,7 @@ public interface PetApi { value = "/pet/findByTags", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); /** @@ -139,32 +140,35 @@ public interface PetApi { value = "/pet/{petId}", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand> getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId); + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId); /** * PUT /pet : Update an existing pet * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid ID supplied (status code 400) + * @param pet Pet object that needs to be added to the store (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) * or Pet not found (status code 404) * or Validation exception (status code 405) */ - @ApiOperation(value = "Update an existing pet", nickname = "updatePet", notes = "", authorizations = { + @ApiOperation(value = "Update an existing pet", nickname = "updatePet", notes = "", response = Pet.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) @RequestMapping( method = RequestMethod.PUT, value = "/pet", + produces = "application/json", consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet); /** @@ -187,7 +191,7 @@ public interface PetApi { value = "/pet/{petId}", consumes = "application/x-www-form-urlencoded" ) - com.netflix.hystrix.HystrixCommand> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestParam(value="status", required=false) String status); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestParam(value="status", required=false) String status); /** @@ -211,6 +215,6 @@ public interface PetApi { produces = "application/json", consumes = "multipart/form-data" ) - com.netflix.hystrix.HystrixCommand> uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @RequestParam("file") MultipartFile file); + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file to upload") @RequestParam("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java index f2f083a51f1..c6928f09386 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java @@ -42,7 +42,7 @@ public interface StoreApi { method = RequestMethod.DELETE, value = "/store/order/{orderId}" ) - com.netflix.hystrix.HystrixCommand> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") String orderId); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") String orderId); /** @@ -62,7 +62,7 @@ public interface StoreApi { value = "/store/inventory", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand>> getInventory(); + ResponseEntity> getInventory(); /** @@ -84,13 +84,13 @@ public interface StoreApi { value = "/store/order/{orderId}", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId); + ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId); /** * POST /store/order : Place an order for a pet * - * @param body order placed for purchasing the pet (required) + * @param order order placed for purchasing the pet (required) * @return successful operation (status code 200) * or Invalid Order (status code 400) */ @@ -101,8 +101,9 @@ public interface StoreApi { @RequestMapping( method = RequestMethod.POST, value = "/store/order", - produces = "application/json" + produces = "application/json", + consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order body); + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order order); } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java index b6bb22edb83..33f0f88d49e 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java @@ -30,49 +30,61 @@ public interface UserApi { * POST /user : Create user * This can only be done by the logged in user. * - * @param body Created user object (required) + * @param user Created user object (required) * @return successful operation (status code 200) */ - @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", }) + @ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping( method = RequestMethod.POST, - value = "/user" + value = "/user", + consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> createUser(@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User body); + ResponseEntity createUser(@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User user); /** * POST /user/createWithArray : Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @return successful operation (status code 200) */ - @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) + @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping( method = RequestMethod.POST, - value = "/user/createWithArray" + value = "/user/createWithArray", + consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List body); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List user); /** * POST /user/createWithList : Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @return successful operation (status code 200) */ - @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) + @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping( method = RequestMethod.POST, - value = "/user/createWithList" + value = "/user/createWithList", + consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List body); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List user); /** @@ -83,7 +95,10 @@ public interface UserApi { * @return Invalid username supplied (status code 400) * or User not found (status code 404) */ - @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", tags={ "user", }) + @ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) @@ -91,7 +106,7 @@ public interface UserApi { method = RequestMethod.DELETE, value = "/user/{username}" ) - com.netflix.hystrix.HystrixCommand> deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username); /** @@ -112,7 +127,7 @@ public interface UserApi { value = "/user/{username}", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username); + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username); /** @@ -132,7 +147,7 @@ public interface UserApi { value = "/user/login", produces = "application/json" ) - com.netflix.hystrix.HystrixCommand> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); + ResponseEntity loginUser(@NotNull @Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); /** @@ -140,14 +155,17 @@ public interface UserApi { * * @return successful operation (status code 200) */ - @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) + @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping( method = RequestMethod.GET, value = "/user/logout" ) - com.netflix.hystrix.HystrixCommand> logoutUser(); + ResponseEntity logoutUser(); /** @@ -155,18 +173,22 @@ public interface UserApi { * This can only be done by the logged in user. * * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param user Updated user object (required) * @return Invalid user supplied (status code 400) * or User not found (status code 404) */ - @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", tags={ "user", }) + @ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) @RequestMapping( method = RequestMethod.PUT, - value = "/user/{username}" + value = "/user/{username}", + consumes = "application/json" ) - com.netflix.hystrix.HystrixCommand> updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User body); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User user); } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 8f503c9cf22..4a28661290d 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; +import org.springframework.cloud.openfeign.security.OAuth2FeignRequestInterceptor; import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; import org.springframework.security.oauth2.client.OAuth2ClientContext; import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitResourceDetails; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java index 1114316e27f..a066fd9e30e 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java @@ -52,7 +52,7 @@ public class Category { */ @ApiModelProperty(value = "") - +@Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java deleted file mode 100644 index 3bebf8f409c..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapitools; - -import feign.Logger; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -@EnableFeignClients -public class Application { - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).run(args); - } - - @Bean - Logger.Level feignLoggerLevel() { - return Logger.Level.FULL; - } -} \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/TestUtils.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/TestUtils.java deleted file mode 100644 index 19900267268..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/TestUtils.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools; - -import java.util.Random; -import java.util.concurrent.atomic.AtomicLong; - -public class TestUtils { - private static final AtomicLong atomicId = createAtomicId(); - - public static long nextId() { - return atomicId.getAndIncrement(); - } - - private static AtomicLong createAtomicId() { - int baseId = new Random(System.currentTimeMillis()).nextInt(1000000) + 20000; - return new AtomicLong((long) baseId); - } -} \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/PetApiTest.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/PetApiTest.java deleted file mode 100644 index 23febe02ace..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/PetApiTest.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.openapitools.api; - -import com.netflix.hystrix.exception.HystrixRuntimeException; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openapitools.Application; -import org.openapitools.TestUtils; -import org.openapitools.model.Category; -import org.openapitools.model.Pet; -import org.openapitools.model.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.*; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class PetApiTest { - - @Autowired - private PetApiClient client; - - @Test - public void testCreateAndGetPet() { - Pet pet = createRandomPet(); - client.addPet(pet).execute(); - Pet fetched = client.getPetById(pet.getId()).execute().getBody(); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - client.updatePet(pet).execute(); - - Pet fetched = client.getPetById(pet.getId()).execute().getBody(); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Ignore - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - client.updatePet(pet).execute(); - - List pets = client.findPetsByStatus(Collections.singletonList("available")).execute().getBody(); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Ignore - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList<>(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - client.updatePet(pet).execute(); - - List pets = client.findPetsByTags(Collections.singletonList("friendly")).execute().getBody(); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - client.addPet(pet).execute(); - - Pet fetched = client.getPetById(pet.getId()).execute().getBody(); - - client.updatePetWithForm(fetched.getId(), "furt", null).execute(); - Pet updated = client.getPetById(fetched.getId()).execute().getBody(); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - client.addPet(pet).execute(); - - Pet fetched = client.getPetById(pet.getId()).execute().getBody(); - client.deletePet(fetched.getId(), null).execute(); - - try { - client.getPetById(fetched.getId()).execute(); - fail("expected an error"); - } catch (HystrixRuntimeException e) { - assertTrue(e.getCause().getMessage().startsWith("status 404 ")); - } - } - - @Ignore("Multipart form is not supported by spring-cloud yet.") - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - client.addPet(pet).execute(); - - MockMultipartFile filePart = new MockMultipartFile("file", "bar".getBytes()); - client.uploadFile(pet.getId(), "a test file", filePart).execute(); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2"); - pet.setPhotoUrls(photos); - - return pet; - } - -} \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/StoreApiTest.java deleted file mode 100644 index 3259d5feeeb..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/StoreApiTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapitools.api; - -import com.netflix.hystrix.exception.HystrixRuntimeException; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openapitools.Application; -import org.openapitools.model.Order; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.time.OffsetDateTime; -import java.util.Map; - -import static org.junit.Assert.*; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class StoreApiTest { - - @Autowired - private StoreApiClient client; - - @Test - public void testGetInventory() { - Map inventory = client.getInventory().execute().getBody(); - assertTrue(inventory.keySet().size() > 0); - } - - @Test - public void testPlaceOrder() { - Order order = createOrder(); - try { - client.deleteOrder(order.getId().toString()).execute(); - } catch (HystrixRuntimeException e) { - // noop - } - client.placeOrder(order).execute(); - - Order fetched = client.getOrderById(order.getId()).execute().getBody(); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - assertEquals(order.getShipDate().toInstant(), fetched.getShipDate().toInstant()); - } - - @Test - public void testDeleteOrder() { - Order order = createOrder(); - client.deleteOrder(order.getId().toString()); - client.placeOrder(order).execute(); - - Order fetched = client.getOrderById(order.getId()).execute().getBody(); - assertEquals(fetched.getId(), order.getId()); - - client.deleteOrder(String.valueOf(order.getId())).execute(); - - try { - client.getOrderById(order.getId()).execute(); - fail("expected an error"); - } catch (HystrixRuntimeException e) { - assertTrue(e.getCause().getMessage().startsWith("status 404 ")); - } - } - - private Order createOrder() { - return new Order() - .id(1L) - .petId(200L) - .quantity(13) - //Ensure 3 fractional digits because of a bug in the petstore server - .shipDate(OffsetDateTime.now().withNano(123000000)) - .status(Order.StatusEnum.PLACED) - .complete(true); - } - -} \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/UserApiTest.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/UserApiTest.java deleted file mode 100644 index a0913cc90a6..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/api/UserApiTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.openapitools.api; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openapitools.Application; -import org.openapitools.TestUtils; -import org.openapitools.model.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class UserApiTest { - - @Autowired - private UserApiClient client; - - @Test - public void testCreateUser() { - User user = createUser(); - - client.createUser(user).execute(); - - User fetched = client.getUserByName(user.getUsername()).execute().getBody(); - assertEquals(user.getUsername(), fetched.getUsername()); - } - - @Test - public void testCreateUsersWithArray() { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - client.createUsersWithArrayInput(Arrays.asList(user1, user2)).execute(); - - User fetched = client.getUserByName(user1.getUsername()).execute().getBody(); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - client.createUsersWithListInput(Arrays.asList(user1, user2)).execute(); - - User fetched = client.getUserByName(user1.getUsername()).execute().getBody(); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() { - User user = createUser(); - client.createUser(user).execute(); - - String token = client.loginUser(user.getUsername(), user.getPassword()).execute().getBody(); - assertTrue(token.contains("logged in user session:")); - } - - @Test - public void logoutUser() { - client.logoutUser().execute(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred"); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } - -} diff --git a/samples/client/petstore/spring-cloud/src/test/resources/application.yml b/samples/client/petstore/spring-cloud/src/test/resources/application.yml deleted file mode 100644 index 05444fc2669..00000000000 --- a/samples/client/petstore/spring-cloud/src/test/resources/application.yml +++ /dev/null @@ -1,11 +0,0 @@ -spring: - application: - name: petstore-test - jackson: - serialization.WRITE_DATES_AS_TIMESTAMPS: false - -hystrix.command.default.execution.timeout.enabled: false - -logging.level.io.swagger.api: DEBUG - -feign.hystrix.enabled: true \ No newline at end of file diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md index 4b9a815e8ae..c16d0a5f2fb 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md @@ -14,7 +14,7 @@ This specification shows how to use x-auth-id-alias extension for API keys. Building the API client library requires: 1. Java 1.7+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:openapi3-extensions-x-auth-id-alias-jersey2-java8:1.0.0" + repositories { + mavenCentral() // Needed if the 'openapi3-extensions-x-auth-id-alias-jersey2-java8' jar has been published to maven central. + mavenLocal() // Needed if the 'openapi3-extensions-x-auth-id-alias-jersey2-java8' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:openapi3-extensions-x-auth-id-alias-jersey2-java8:1.0.0" + } ``` ### Others diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle index 7af266cd572..b422fd584fe 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -77,13 +75,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'openapi3-extensions-x-auth-id-alias-jersey2-java8' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi3-extensions-x-auth-id-alias-jersey2-java8' + + from components.java + } } } diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle.properties b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle.properties +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar and b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew.bat b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew.bat +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index 2b7e10416d2..5b299b6b2cd 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -72,7 +72,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; - } + + } return Future.value(); } @@ -203,6 +204,7 @@ class PetApi { return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); + } return Future>.value(); } @@ -272,6 +274,7 @@ class PetApi { return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); + } return Future>.value(); } @@ -337,7 +340,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; - } + + } return Future.value(); } @@ -397,7 +401,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; - } + + } return Future.value(); } @@ -556,7 +561,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart index 9a02b1f9510..0c5c49a9554 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart @@ -119,6 +119,7 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); + } return Future>.value(); } @@ -184,7 +185,8 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } + + } return Future.value(); } @@ -244,7 +246,8 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart index 22f0fb7b25f..3d30943890f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart @@ -294,7 +294,8 @@ class UserApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; - } + + } return Future.value(); } @@ -366,7 +367,8 @@ class UserApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; - } + + } return Future.value(); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml index 163b29ec3ec..00043ba660c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -12,7 +12,5 @@ dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' meta: '^1.1.8' - dev_dependencies: test: '>=1.16.0 <1.18.0' - diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart index e74ea06483b..61a4d778667 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -76,7 +76,8 @@ class AnotherFakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 1f3eca5bc84..15119087b63 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -54,7 +54,8 @@ class DefaultApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 33c43243404..5ffad95f3b6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -57,7 +57,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; - } + + } return Future.value(); } @@ -187,7 +188,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; - } + + } return Future.value(); } @@ -244,7 +246,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; - } + + } return Future.value(); } @@ -301,7 +304,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; - } + + } return Future.value(); } @@ -358,7 +362,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; - } + + } return Future.value(); } @@ -418,7 +423,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; - } + + } return Future.value(); } @@ -641,7 +647,8 @@ class FakeApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; - } + + } return Future.value(); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 9f92e00b7bd..8686e9e7bab 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -76,7 +76,8 @@ class FakeClassnameTags123Api { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index b9217fef597..8cfcf9eb9a0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -196,6 +196,7 @@ class PetApi { return (await apiClient.deserializeAsync(responseBody, 'List') as List) .cast() .toList(growable: false); + } return Future>.value(); } @@ -265,6 +266,7 @@ class PetApi { return (await apiClient.deserializeAsync(responseBody, 'Set') as List) .cast() .toSet(); + } return Future>.value(); } @@ -330,7 +332,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; - } + + } return Future.value(); } @@ -542,7 +545,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; - } + + } return Future.value(); } @@ -632,7 +636,8 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart index 2137c99ba85..121f16a9f90 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart @@ -119,6 +119,7 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); + } return Future>.value(); } @@ -184,7 +185,8 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } + + } return Future.value(); } @@ -244,7 +246,8 @@ class StoreApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } + + } return Future.value(); } } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart index ceecb982903..9838b689d7a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart @@ -294,7 +294,8 @@ class UserApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; - } + + } return Future.value(); } @@ -366,7 +367,8 @@ class UserApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; - } + + } return Future.value(); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index ed19ac29634..d3c64b9adc3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -229,7 +229,6 @@ class ApiClient { return EnumArrays.fromJson(value); case 'EnumClass': return EnumClassTypeTransformer().decode(value); - case 'EnumTest': return EnumTest.fromJson(value); case 'FileSchemaTestClass': @@ -272,16 +271,12 @@ class ApiClient { return OuterComposite.fromJson(value); case 'OuterEnum': return OuterEnumTypeTransformer().decode(value); - case 'OuterEnumDefaultValue': return OuterEnumDefaultValueTypeTransformer().decode(value); - case 'OuterEnumInteger': return OuterEnumIntegerTypeTransformer().decode(value); - case 'OuterEnumIntegerDefaultValue': return OuterEnumIntegerDefaultValueTypeTransformer().decode(value); - case 'OuterObjectWithEnumProperty': return OuterObjectWithEnumProperty.fromJson(value); case 'Pet': diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml index 163b29ec3ec..00043ba660c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml @@ -12,7 +12,5 @@ dependencies: http: '>=0.13.0 <0.14.0' intl: '^0.17.0' meta: '^1.1.8' - dev_dependencies: test: '>=1.16.0 <1.18.0' - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore deleted file mode 100644 index 8b7331fd822..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# See https://www.dartlang.org/tools/private-files.html - -# Files and directories created by pub -.buildlog -.packages -.project -.pub/ -build/ -**/packages/ - -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc -doc/api/ - -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a3..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES deleted file mode 100644 index f944df3328e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES +++ /dev/null @@ -1,122 +0,0 @@ -.gitignore -.travis.yml -README.md -analysis_options.yaml -build.yaml -doc/AdditionalPropertiesClass.md -doc/Animal.md -doc/AnotherFakeApi.md -doc/ApiResponse.md -doc/ArrayOfArrayOfNumberOnly.md -doc/ArrayOfNumberOnly.md -doc/ArrayTest.md -doc/Capitalization.md -doc/Cat.md -doc/CatAllOf.md -doc/Category.md -doc/ClassModel.md -doc/DefaultApi.md -doc/DeprecatedObject.md -doc/Dog.md -doc/DogAllOf.md -doc/EnumArrays.md -doc/EnumClass.md -doc/EnumTest.md -doc/FakeApi.md -doc/FakeClassnameTags123Api.md -doc/FileSchemaTestClass.md -doc/Foo.md -doc/FormatTest.md -doc/HasOnlyReadOnly.md -doc/HealthCheckResult.md -doc/InlineResponseDefault.md -doc/MapTest.md -doc/MixedPropertiesAndAdditionalPropertiesClass.md -doc/Model200Response.md -doc/ModelClient.md -doc/ModelFile.md -doc/ModelList.md -doc/ModelReturn.md -doc/Name.md -doc/NullableClass.md -doc/NumberOnly.md -doc/ObjectWithDeprecatedFields.md -doc/Order.md -doc/OuterComposite.md -doc/OuterEnum.md -doc/OuterEnumDefaultValue.md -doc/OuterEnumInteger.md -doc/OuterEnumIntegerDefaultValue.md -doc/OuterObjectWithEnumProperty.md -doc/Pet.md -doc/PetApi.md -doc/ReadOnlyFirst.md -doc/SpecialModelName.md -doc/StoreApi.md -doc/Tag.md -doc/User.md -doc/UserApi.md -git_push.sh -lib/api.dart -lib/api/another_fake_api.dart -lib/api/default_api.dart -lib/api/fake_api.dart -lib/api/fake_classname_tags123_api.dart -lib/api/pet_api.dart -lib/api/store_api.dart -lib/api/user_api.dart -lib/api_client.dart -lib/api_exception.dart -lib/api_helper.dart -lib/auth/api_key_auth.dart -lib/auth/authentication.dart -lib/auth/http_basic_auth.dart -lib/auth/http_bearer_auth.dart -lib/auth/oauth.dart -lib/model/additional_properties_class.dart -lib/model/animal.dart -lib/model/api_response.dart -lib/model/array_of_array_of_number_only.dart -lib/model/array_of_number_only.dart -lib/model/array_test.dart -lib/model/capitalization.dart -lib/model/cat.dart -lib/model/cat_all_of.dart -lib/model/category.dart -lib/model/class_model.dart -lib/model/deprecated_object.dart -lib/model/dog.dart -lib/model/dog_all_of.dart -lib/model/enum_arrays.dart -lib/model/enum_class.dart -lib/model/enum_test.dart -lib/model/file_schema_test_class.dart -lib/model/foo.dart -lib/model/format_test.dart -lib/model/has_only_read_only.dart -lib/model/health_check_result.dart -lib/model/inline_response_default.dart -lib/model/map_test.dart -lib/model/mixed_properties_and_additional_properties_class.dart -lib/model/model200_response.dart -lib/model/model_client.dart -lib/model/model_file.dart -lib/model/model_list.dart -lib/model/model_return.dart -lib/model/name.dart -lib/model/nullable_class.dart -lib/model/number_only.dart -lib/model/object_with_deprecated_fields.dart -lib/model/order.dart -lib/model/outer_composite.dart -lib/model/outer_enum.dart -lib/model/outer_enum_default_value.dart -lib/model/outer_enum_integer.dart -lib/model/outer_enum_integer_default_value.dart -lib/model/outer_object_with_enum_property.dart -lib/model/pet.dart -lib/model/read_only_first.dart -lib/model/special_model_name.dart -lib/model/tag.dart -lib/model/user.dart -pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION deleted file mode 100644 index 5f68295fc19..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -6.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml deleted file mode 100644 index 1a3af66d54c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# -# https://docs.travis-ci.com/user/languages/dart/ -# -language: dart -dart: -# Install a specific stable release -- "2.2.0" -install: -- pub get - -script: -- pub run test diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md deleted file mode 100644 index db2f2c26eac..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# openapi -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Build package: org.openapitools.codegen.languages.DartClientCodegen - -## Requirements - -Dart 2.0 or later - -## Installation & Usage - -### Github -If this Dart package is published to Github, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git -``` - -### Local -To use the package in your local drive, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - path: /path/to/openapi -``` - -## Tests - -TODO - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```dart -import 'package:openapi/api.dart'; - - -final api_instance = AnotherFakeApi(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.call123testSpecialTags(modelClient); - print(result); -} catch (e) { - print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); -} - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags -*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | -*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint -*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication -*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | -*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | -*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | -*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | -*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | -*FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | -*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | -*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | -*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | -*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -## Documentation For Models - - - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) - - [Animal](doc//Animal.md) - - [ApiResponse](doc//ApiResponse.md) - - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) - - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) - - [ArrayTest](doc//ArrayTest.md) - - [Capitalization](doc//Capitalization.md) - - [Cat](doc//Cat.md) - - [CatAllOf](doc//CatAllOf.md) - - [Category](doc//Category.md) - - [ClassModel](doc//ClassModel.md) - - [DeprecatedObject](doc//DeprecatedObject.md) - - [Dog](doc//Dog.md) - - [DogAllOf](doc//DogAllOf.md) - - [EnumArrays](doc//EnumArrays.md) - - [EnumClass](doc//EnumClass.md) - - [EnumTest](doc//EnumTest.md) - - [FileSchemaTestClass](doc//FileSchemaTestClass.md) - - [Foo](doc//Foo.md) - - [FormatTest](doc//FormatTest.md) - - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) - - [HealthCheckResult](doc//HealthCheckResult.md) - - [InlineResponseDefault](doc//InlineResponseDefault.md) - - [MapTest](doc//MapTest.md) - - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - - [Model200Response](doc//Model200Response.md) - - [ModelClient](doc//ModelClient.md) - - [ModelFile](doc//ModelFile.md) - - [ModelList](doc//ModelList.md) - - [ModelReturn](doc//ModelReturn.md) - - [Name](doc//Name.md) - - [NullableClass](doc//NullableClass.md) - - [NumberOnly](doc//NumberOnly.md) - - [ObjectWithDeprecatedFields](doc//ObjectWithDeprecatedFields.md) - - [Order](doc//Order.md) - - [OuterComposite](doc//OuterComposite.md) - - [OuterEnum](doc//OuterEnum.md) - - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) - - [OuterEnumInteger](doc//OuterEnumInteger.md) - - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) - - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md) - - [Pet](doc//Pet.md) - - [ReadOnlyFirst](doc//ReadOnlyFirst.md) - - [SpecialModelName](doc//SpecialModelName.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) - - -## Documentation For Authorization - - -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - -## api_key_query - -- **Type**: API key -- **API key parameter name**: api_key_query -- **Location**: URL query string - -## bearer_test - -- **Type**: HTTP Bearer authentication - -## http_basic_test - -- **Type**: HTTP Basic authentication - -## http_signature_test - - -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - -## Author - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/analysis_options.yaml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml deleted file mode 100644 index 89a4dd6e1c2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml +++ /dev/null @@ -1,18 +0,0 @@ -targets: - $default: - builders: - json_serializable: - options: - # Options configure how source code is generated for every - # `@JsonSerializable`-annotated class in the package. - # - # The default value for each is listed. - any_map: false - checked: true - create_factory: true - create_to_json: true - disallow_unrecognized_keys: true - explicit_to_json: true - field_rename: none - ignore_unannotated: false - include_if_null: false diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md deleted file mode 100644 index 859d4d0b7a0..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.AdditionalPropertiesClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mapProperty** | **Map** | | [optional] [default to const {}] -**mapOfMapProperty** | [**Map>**](Map.md) | | [optional] [default to const {}] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md deleted file mode 100644 index 415b56e9bc2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Animal - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **String** | | -**color** | **String** | | [optional] [default to 'red'] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md deleted file mode 100644 index 241c82e575d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md +++ /dev/null @@ -1,57 +0,0 @@ -# openapi.api.AnotherFakeApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - - -# **call123testSpecialTags** -> ModelClient call123testSpecialTags(modelClient) - -To test special tags - -To test special tags and operation ID starting with number - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = AnotherFakeApi(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.call123testSpecialTags(modelClient); - print(result); -} catch (e) { - print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **modelClient** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md deleted file mode 100644 index 7ad5da0f89e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] -**type** | **String** | | [optional] -**message** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md deleted file mode 100644 index 0a0dc2a7b75..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ArrayOfArrayOfNumberOnly - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayArrayNumber** | [**List>**](List.md) | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md deleted file mode 100644 index 01b6f58870f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ArrayOfNumberOnly - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayNumber** | **List** | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md deleted file mode 100644 index 598a895bb20..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ArrayTest - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayOfString** | **List** | | [optional] [default to const []] -**arrayArrayOfInteger** | [**List>**](List.md) | | [optional] [default to const []] -**arrayArrayOfModel** | [**List>**](List.md) | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md deleted file mode 100644 index 4a07b4eb820..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Capitalization - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**smallCamel** | **String** | | [optional] -**capitalCamel** | **String** | | [optional] -**smallSnake** | **String** | | [optional] -**capitalSnake** | **String** | | [optional] -**sCAETHFlowPoints** | **String** | | [optional] -**ATT_NAME** | **String** | Name of the pet | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md deleted file mode 100644 index 6552eea4b43..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.Cat - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **String** | | -**color** | **String** | | [optional] [default to 'red'] -**declawed** | **bool** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md deleted file mode 100644 index 36b2ae0e8ab..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.CatAllOf - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**declawed** | **bool** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md deleted file mode 100644 index ae6bc52e89d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**name** | **String** | | [default to 'default-name'] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md deleted file mode 100644 index 13ae5d3a470..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ClassModel - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md deleted file mode 100644 index d7b1c748f14..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md +++ /dev/null @@ -1,51 +0,0 @@ -# openapi.api.DefaultApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | - - -# **fooGet** -> InlineResponseDefault fooGet() - - - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = DefaultApi(); - -try { - final result = api_instance.fooGet(); - print(result); -} catch (e) { - print('Exception when calling DefaultApi->fooGet: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**InlineResponseDefault**](InlineResponseDefault.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DeprecatedObject.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DeprecatedObject.md deleted file mode 100644 index bf2ef67a26f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DeprecatedObject.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.DeprecatedObject - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md deleted file mode 100644 index d36439b767b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.Dog - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **String** | | -**color** | **String** | | [optional] [default to 'red'] -**breed** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md deleted file mode 100644 index 97a7c8fba49..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.DogAllOf - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**breed** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md deleted file mode 100644 index 2c12a0e6168..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.EnumArrays - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**justSymbol** | **String** | | [optional] -**arrayEnum** | **List** | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md deleted file mode 100644 index a9ed4c1f0c8..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md +++ /dev/null @@ -1,14 +0,0 @@ -# openapi.model.EnumClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md deleted file mode 100644 index 7c24fe2347b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.EnumTest - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**enumString** | **String** | | [optional] -**enumStringRequired** | **String** | | -**enumInteger** | **int** | | [optional] -**enumNumber** | **double** | | [optional] -**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] -**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] -**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] -**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md deleted file mode 100644 index 869c513b1f2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md +++ /dev/null @@ -1,816 +0,0 @@ -# openapi.api.FakeApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | -[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | -[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | -[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | -[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | -[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -[**testEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**testEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -[**testGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -[**testInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | - - -# **fakeHealthGet** -> HealthCheckResult fakeHealthGet() - -Health check endpoint - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); - -try { - final result = api_instance.fakeHealthGet(); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeHealthGet: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**HealthCheckResult**](HealthCheckResult.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeHttpSignatureTest** -> fakeHttpSignatureTest(pet, query1, header1) - -test http signature authentication - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store -final query1 = query1_example; // String | query parameter -final header1 = header1_example; // String | header parameter - -try { - api_instance.fakeHttpSignatureTest(pet, query1, header1); -} catch (e) { - print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - **query1** | **String**| query parameter | [optional] - **header1** | **String**| header parameter | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeOuterBooleanSerialize** -> bool fakeOuterBooleanSerialize(body) - - - -Test serialization of outer boolean types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = bool(); // bool | Input boolean as post body - -try { - final result = api_instance.fakeOuterBooleanSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] - -### Return type - -**bool** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeOuterCompositeSerialize** -> OuterComposite fakeOuterCompositeSerialize(outerComposite) - - - -Test serialization of object with outer number type - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final outerComposite = OuterComposite(); // OuterComposite | Input composite as post body - -try { - final result = api_instance.fakeOuterCompositeSerialize(outerComposite); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] - -### Return type - -[**OuterComposite**](OuterComposite.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeOuterNumberSerialize** -> num fakeOuterNumberSerialize(body) - - - -Test serialization of outer number types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = num(); // num | Input number as post body - -try { - final result = api_instance.fakeOuterNumberSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **num**| Input number as post body | [optional] - -### Return type - -**num** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakeOuterStringSerialize** -> String fakeOuterStringSerialize(body) - - - -Test serialization of outer string types - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = String(); // String | Input string as post body - -try { - final result = api_instance.fakeOuterStringSerialize(body); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Input string as post body | [optional] - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fakePropertyEnumIntegerSerialize** -> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) - - - -Test serialization of enum (int) properties with examples - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final outerObjectWithEnumProperty = OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body - -try { - final result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); - print(result); -} catch (e) { - print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | - -### Return type - -[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testBodyWithBinary** -> testBodyWithBinary(body) - - - -For this test, the body has to be a binary file. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final body = MultipartFile(); // MultipartFile | image to upload - -try { - api_instance.testBodyWithBinary(body); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **MultipartFile**| image to upload | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: image/png - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testBodyWithFileSchema** -> testBodyWithFileSchema(fileSchemaTestClass) - - - -For this test, the body for this request must reference a schema named `File`. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | - -try { - api_instance.testBodyWithFileSchema(fileSchemaTestClass); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testBodyWithQueryParams** -> testBodyWithQueryParams(query, user) - - - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final query = query_example; // String | -final user = User(); // User | - -try { - api_instance.testBodyWithQueryParams(query, user); -} catch (e) { - print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **query** | **String**| | - **user** | [**User**](User.md)| | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testClientModel** -> ModelClient testClientModel(modelClient) - -To test \"client\" model - -To test \"client\" model - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.testClientModel(modelClient); - print(result); -} catch (e) { - print('Exception when calling FakeApi->testClientModel: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **modelClient** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testEndpointParameters** -> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure HTTP basic authorization: http_basic_test -//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' -//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; - -final api_instance = FakeApi(); -final number = 8.14; // num | None -final double_ = 1.2; // double | None -final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None -final byte = BYTE_ARRAY_DATA_HERE; // String | None -final integer = 56; // int | None -final int32 = 56; // int | None -final int64 = 789; // int | None -final float = 3.4; // double | None -final string = string_example; // String | None -final binary = BINARY_DATA_HERE; // MultipartFile | None -final date = 2013-10-20; // DateTime | None -final dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None -final password = password_example; // String | None -final callback = callback_example; // String | None - -try { - api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); -} catch (e) { - print('Exception when calling FakeApi->testEndpointParameters: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **num**| None | - **double_** | **double**| None | - **patternWithoutDelimiter** | **String**| None | - **byte** | **String**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **int**| None | [optional] - **float** | **double**| None | [optional] - **string** | **String**| None | [optional] - **binary** | **MultipartFile**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] - **password** | **String**| None | [optional] - **callback** | **String**| None | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[http_basic_test](../README.md#http_basic_test) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) - -To test enum parameters - -To test enum parameters - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final enumHeaderStringArray = []; // List | Header parameter enum test (string array) -final enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) -final enumQueryStringArray = []; // List | Query parameter enum test (string array) -final enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) -final enumQueryInteger = 56; // int | Query parameter enum test (double) -final enumQueryDouble = 1.2; // double | Query parameter enum test (double) -final enumFormStringArray = []; // List | Form parameter enum test (string array) -final enumFormString = enumFormString_example; // String | Form parameter enum test (string) - -try { - api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (e) { - print('Exception when calling FakeApi->testEnumParameters: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**List**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] - **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] - **enumQueryStringArray** | [**List**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] - **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | [**List**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] - **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testGroupParameters** -> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) - -Fake endpoint to test group parameters (optional) - -Fake endpoint to test group parameters (optional) - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure HTTP Bearer authorization: bearer_test -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer_test').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer_test').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = FakeApi(); -final requiredStringGroup = 56; // int | Required String in group parameters -final requiredBooleanGroup = true; // bool | Required Boolean in group parameters -final requiredInt64Group = 789; // int | Required Integer in group parameters -final stringGroup = 56; // int | String in group parameters -final booleanGroup = true; // bool | Boolean in group parameters -final int64Group = 789; // int | Integer in group parameters - -try { - api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (e) { - print('Exception when calling FakeApi->testGroupParameters: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requiredStringGroup** | **int**| Required String in group parameters | - **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | - **requiredInt64Group** | **int**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **int**| Integer in group parameters | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[bearer_test](../README.md#bearer_test) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testInlineAdditionalProperties** -> testInlineAdditionalProperties(requestBody) - -test inline additionalProperties - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final requestBody = Map(); // Map | request body - -try { - api_instance.testInlineAdditionalProperties(requestBody); -} catch (e) { - print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requestBody** | [**Map**](String.md)| request body | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testJsonFormData** -> testJsonFormData(param, param2) - -test json serialization of form data - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final param = param_example; // String | field1 -final param2 = param2_example; // String | field2 - -try { - api_instance.testJsonFormData(param, param2); -} catch (e) { - print('Exception when calling FakeApi->testJsonFormData: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | - **param2** | **String**| field2 | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) - - - -To test the collection format in query parameters - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = FakeApi(); -final pipe = []; // List | -final ioutil = []; // List | -final http = []; // List | -final url = []; // List | -final context = []; // List | -final allowEmpty = allowEmpty_example; // String | -final language = ; // Map | - -try { - api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); -} catch (e) { - print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipe** | [**List**](String.md)| | [default to const []] - **ioutil** | [**List**](String.md)| | [default to const []] - **http** | [**List**](String.md)| | [default to const []] - **url** | [**List**](String.md)| | [default to const []] - **context** | [**List**](String.md)| | [default to const []] - **allowEmpty** | **String**| | - **language** | [**Map**](String.md)| | [optional] [default to const {}] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md deleted file mode 100644 index 5518c67403f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md +++ /dev/null @@ -1,61 +0,0 @@ -# openapi.api.FakeClassnameTags123Api - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case - - -# **testClassname** -> ModelClient testClassname(modelClient) - -To test class name in snake case - -To test class name in snake case - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key_query -//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; - -final api_instance = FakeClassnameTags123Api(); -final modelClient = ModelClient(); // ModelClient | client model - -try { - final result = api_instance.testClassname(modelClient); - print(result); -} catch (e) { - print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **modelClient** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -[api_key_query](../README.md#api_key_query) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md deleted file mode 100644 index eae1dfbe979..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.FileSchemaTestClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**file** | [**ModelFile**](ModelFile.md) | | [optional] -**files** | [**List**](ModelFile.md) | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md deleted file mode 100644 index 185b76e3f5b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.Foo - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **String** | | [optional] [default to 'bar'] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md deleted file mode 100644 index 83b60545eb6..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md +++ /dev/null @@ -1,30 +0,0 @@ -# openapi.model.FormatTest - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integer** | **int** | | [optional] -**int32** | **int** | | [optional] -**int64** | **int** | | [optional] -**number** | **num** | | -**float** | **double** | | [optional] -**double_** | **double** | | [optional] -**decimal** | **double** | | [optional] -**string** | **String** | | [optional] -**byte** | **String** | | -**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] -**date** | [**DateTime**](DateTime.md) | | -**dateTime** | [**DateTime**](DateTime.md) | | [optional] -**uuid** | **String** | | [optional] -**password** | **String** | | -**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] -**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md deleted file mode 100644 index f2d30e9fb68..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.HasOnlyReadOnly - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **String** | | [optional] [readonly] -**foo** | **String** | | [optional] [readonly] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md deleted file mode 100644 index 4d6aeb75d96..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.HealthCheckResult - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**nullableMessage** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md deleted file mode 100644 index c5e61e1162b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.InlineResponseDefault - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**string** | [**Foo**](Foo.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md deleted file mode 100644 index a1732207bfc..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md +++ /dev/null @@ -1,18 +0,0 @@ -# openapi.model.MapTest - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mapMapOfString** | [**Map>**](Map.md) | | [optional] [default to const {}] -**mapOfEnumString** | **Map** | | [optional] [default to const {}] -**directMap** | **Map** | | [optional] [default to const {}] -**indirectMap** | **Map** | | [optional] [default to const {}] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md deleted file mode 100644 index 1f7f66b684f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.MixedPropertiesAndAdditionalPropertiesClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **String** | | [optional] -**dateTime** | [**DateTime**](DateTime.md) | | [optional] -**map** | [**Map**](Animal.md) | | [optional] [default to const {}] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md deleted file mode 100644 index 5aa3fb97c32..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Model200Response - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **int** | | [optional] -**class_** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md deleted file mode 100644 index f7b922f4a39..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ModelClient - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**client** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md deleted file mode 100644 index 4be260e93f6..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ModelFile - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sourceURI** | **String** | Test capitalization | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md deleted file mode 100644 index 283aa1f6b71..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ModelList - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**n123list** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md deleted file mode 100644 index bc02df7a369..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.ModelReturn - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**return_** | **int** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md deleted file mode 100644 index 9da6e75fbf5..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md +++ /dev/null @@ -1,18 +0,0 @@ -# openapi.model.Name - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **int** | | -**snakeCase** | **int** | | [optional] [readonly] -**property** | **String** | | [optional] -**n123number** | **int** | | [optional] [readonly] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md deleted file mode 100644 index 9b2e46df0a0..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md +++ /dev/null @@ -1,26 +0,0 @@ -# openapi.model.NullableClass - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integerProp** | **int** | | [optional] -**numberProp** | **num** | | [optional] -**booleanProp** | **bool** | | [optional] -**stringProp** | **String** | | [optional] -**dateProp** | [**DateTime**](DateTime.md) | | [optional] -**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] -**arrayNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] -**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] -**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] -**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md deleted file mode 100644 index d8096a3db37..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.NumberOnly - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**justNumber** | **num** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ObjectWithDeprecatedFields.md deleted file mode 100644 index 566816d8d27..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ObjectWithDeprecatedFields.md +++ /dev/null @@ -1,18 +0,0 @@ -# openapi.model.ObjectWithDeprecatedFields - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **String** | | [optional] -**id** | **num** | | [optional] -**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] -**bars** | **List** | | [optional] [default to const []] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md deleted file mode 100644 index bde5ffe51a2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**petId** | **int** | | [optional] -**quantity** | **int** | | [optional] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] -**status** | **String** | Order Status | [optional] -**complete** | **bool** | | [optional] [default to false] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md deleted file mode 100644 index 04bab7eff5d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.OuterComposite - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**myNumber** | **num** | | [optional] -**myString** | **String** | | [optional] -**myBoolean** | **bool** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md deleted file mode 100644 index af62ad87ab2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md +++ /dev/null @@ -1,14 +0,0 @@ -# openapi.model.OuterEnum - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md deleted file mode 100644 index c1bf8b0dec4..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md +++ /dev/null @@ -1,14 +0,0 @@ -# openapi.model.OuterEnumDefaultValue - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md deleted file mode 100644 index 8c80a9e5c85..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md +++ /dev/null @@ -1,14 +0,0 @@ -# openapi.model.OuterEnumInteger - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md deleted file mode 100644 index eb8b55d7024..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md +++ /dev/null @@ -1,14 +0,0 @@ -# openapi.model.OuterEnumIntegerDefaultValue - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md deleted file mode 100644 index eab2ae8f66b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.OuterObjectWithEnumProperty - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md deleted file mode 100644 index b6fdea5299b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**category** | [**Category**](Category.md) | | [optional] -**name** | **String** | | -**photoUrls** | **Set** | | [default to const {}] -**tags** | [**List**](Tag.md) | | [optional] [default to const []] -**status** | **String** | pet status in the store | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md deleted file mode 100644 index 387717e3f91..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md +++ /dev/null @@ -1,427 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) - - -# **addPet** -> addPet(pet) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(pet); -} catch (e) { - print('Exception when calling PetApi->addPet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | Pet id to delete -final apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print('Exception when calling PetApi->deletePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **apiKey** | **String**| | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByStatus** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final status = []; // List | Status values that need to be considered for filter - -try { - final result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByStatus: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> Set findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final tags = []; // Set | Tags to filter by - -try { - final result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByTags: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**Set**](String.md)| Tags to filter by | [default to const {}] - -### Return type - -[**Set**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to return - -try { - final result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print('Exception when calling PetApi->getPetById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(pet) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final pet = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(pet); -} catch (e) { - print('Exception when calling PetApi->updatePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet that needs to be updated -final name = name_example; // String | Updated name of the pet -final status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print('Exception when calling PetApi->updatePetWithForm: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] - **status** | **String**| Updated status of the pet | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) - -uploads an image - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to update -final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -final file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - final result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] - **file** | **MultipartFile**| file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **uploadFileWithRequiredFile** -> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) - -uploads an image (required) - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to update -final requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload -final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server - -try { - final result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **requiredFile** | **MultipartFile**| file to upload | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md deleted file mode 100644 index fa6f9e4305d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.ReadOnlyFirst - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **String** | | [optional] [readonly] -**baz** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md deleted file mode 100644 index 5fcfa98e0b3..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md +++ /dev/null @@ -1,15 +0,0 @@ -# openapi.model.SpecialModelName - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md deleted file mode 100644 index f43230375e7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print('Exception when calling StoreApi->deleteOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventory** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; - -final api_instance = StoreApi(); - -try { - final result = api_instance.getInventory(); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getInventory: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = 789; // int | ID of pet that needs to be fetched - -try { - final result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getOrderById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(order) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final order = Order(); // Order | order placed for purchasing the pet - -try { - final result = api_instance.placeOrder(order); - print(result); -} catch (e) { - print('Exception when calling StoreApi->placeOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md deleted file mode 100644 index c219f987c19..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Tag - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**name** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md deleted file mode 100644 index fa87e64d859..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**username** | **String** | | [optional] -**firstName** | **String** | | [optional] -**lastName** | **String** | | [optional] -**email** | **String** | | [optional] -**password** | **String** | | [optional] -**phone** | **String** | | [optional] -**userStatus** | **int** | User Status | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md deleted file mode 100644 index f318f92ccef..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createuser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -# **createUser** -> createUser(user) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = User(); // User | Created user object - -try { - api_instance.createUser(user); -} catch (e) { - print('Exception when calling UserApi->createUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithArrayInput** -> createUsersWithArrayInput(user) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = [List()]; // List | List of user object - -try { - api_instance.createUsersWithArrayInput(user); -} catch (e) { - print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithListInput** -> createUsersWithListInput(user) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final user = [List()]; // List | List of user object - -try { - api_instance.createUsersWithListInput(user); -} catch (e) { - print('Exception when calling UserApi->createUsersWithListInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print('Exception when calling UserApi->deleteUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - final result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print('Exception when calling UserApi->getUserByName: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The user name for login -final password = password_example; // String | The password for login in clear text - -try { - final result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print('Exception when calling UserApi->loginUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **password** | **String**| The password for login in clear text | - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **logoutUser** -> logoutUser() - -Logs out current logged in user session - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print('Exception when calling UserApi->logoutUser: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, user) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | name that need to be deleted -final user = User(); // User | Updated user object - -try { - api_instance.updateUser(username, user); -} catch (e) { - print('Exception when calling UserApi->updateUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh deleted file mode 100644 index f53a75d4fab..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart deleted file mode 100644 index 920f26ddc57..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart +++ /dev/null @@ -1,95 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -library openapi.api; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:http/http.dart'; -import 'package:intl/intl.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:meta/meta.dart'; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/api_key_auth.dart'; -part 'auth/oauth.dart'; -part 'auth/http_basic_auth.dart'; -part 'auth/http_bearer_auth.dart'; - -part 'api/another_fake_api.dart'; -part 'api/default_api.dart'; -part 'api/fake_api.dart'; -part 'api/fake_classname_tags123_api.dart'; -part 'api/pet_api.dart'; -part 'api/store_api.dart'; -part 'api/user_api.dart'; - -part 'model/additional_properties_class.dart'; -part 'model/animal.dart'; -part 'model/api_response.dart'; -part 'model/array_of_array_of_number_only.dart'; -part 'model/array_of_number_only.dart'; -part 'model/array_test.dart'; -part 'model/capitalization.dart'; -part 'model/cat.dart'; -part 'model/cat_all_of.dart'; -part 'model/category.dart'; -part 'model/class_model.dart'; -part 'model/deprecated_object.dart'; -part 'model/dog.dart'; -part 'model/dog_all_of.dart'; -part 'model/enum_arrays.dart'; -part 'model/enum_class.dart'; -part 'model/enum_test.dart'; -part 'model/file_schema_test_class.dart'; -part 'model/foo.dart'; -part 'model/format_test.dart'; -part 'model/has_only_read_only.dart'; -part 'model/health_check_result.dart'; -part 'model/inline_response_default.dart'; -part 'model/map_test.dart'; -part 'model/mixed_properties_and_additional_properties_class.dart'; -part 'model/model200_response.dart'; -part 'model/model_client.dart'; -part 'model/model_file.dart'; -part 'model/model_list.dart'; -part 'model/model_return.dart'; -part 'model/name.dart'; -part 'model/nullable_class.dart'; -part 'model/number_only.dart'; -part 'model/object_with_deprecated_fields.dart'; -part 'model/order.dart'; -part 'model/outer_composite.dart'; -part 'model/outer_enum.dart'; -part 'model/outer_enum_default_value.dart'; -part 'model/outer_enum_integer.dart'; -part 'model/outer_enum_integer_default_value.dart'; -part 'model/outer_object_with_enum_property.dart'; -part 'model/pet.dart'; -part 'model/read_only_first.dart'; -part 'model/special_model_name.dart'; -part 'model/tag.dart'; -part 'model/user.dart'; - - -part 'api.g.dart'; -const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; -const _dateEpochMarker = 'epoch'; -final _dateFormatter = DateFormat('yyyy-MM-dd'); -final _regList = RegExp(r'^List<(.*)>$'); -final _regSet = RegExp(r'^Set<(.*)>$'); -final _regMap = RegExp(r'^Map$'); - -ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart deleted file mode 100644 index 2295e5df8ad..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class AnotherFakeApi { - AnotherFakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// To test special tags - /// - /// To test special tags and operation ID starting with number - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - - // ignore: prefer_const_declarations - final path = r'/another-fake/dummy'; - - // ignore: prefer_final_locals - Object postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test special tags - /// - /// To test special tags and operation ID starting with number - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future call123testSpecialTags(ModelClient modelClient,) async { - final response = await call123testSpecialTagsWithHttpInfo(modelClient,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return ModelClient.fromJson(json.decode(response.body)); - } - return Future.value(); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart deleted file mode 100644 index 8f485dacf17..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart +++ /dev/null @@ -1,61 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class DefaultApi { - DefaultApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Performs an HTTP 'GET /foo' operation and returns the [Response]. - Future fooGetWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/foo'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - Future fooGet() async { - final response = await fooGetWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return InlineResponseDefault.fromJson(json.decode(response.body)); - } - return Future.value(); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart deleted file mode 100644 index 05fedc622a2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart +++ /dev/null @@ -1,1287 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class FakeApi { - FakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Health check endpoint - /// - /// Note: This method returns the HTTP [Response]. - Future fakeHealthGetWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/fake/health'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Health check endpoint - Future fakeHealthGet() async { - final response = await fakeHealthGetWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return HealthCheckResult.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// test http signature authentication - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - /// - /// * [String] query1: - /// query parameter - /// - /// * [String] header1: - /// header parameter - Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1, }) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/http-signature-test'; - - // ignore: prefer_final_locals - Object postBody = pet; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (query1 != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'query_1', query1)); - } - - if (header1 != null) { - headerParams[r'header_1'] = parameterToString(header1); - } - - const authNames = ['http_signature_test']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test http signature authentication - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - /// - /// * [String] query1: - /// query parameter - /// - /// * [String] header1: - /// header parameter - Future fakeHttpSignatureTest(Pet pet, { String query1, String header1, }) async { - final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Test serialization of outer boolean types - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [bool] body: - /// Input boolean as post body - Future fakeOuterBooleanSerializeWithHttpInfo({ bool body, }) async { - // Verify required params are set. - - // ignore: prefer_const_declarations - final path = r'/fake/outer/boolean'; - - // ignore: prefer_final_locals - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer boolean types - /// - /// Parameters: - /// - /// * [bool] body: - /// Input boolean as post body - Future fakeOuterBooleanSerialize({ bool body, }) async { - final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return response.body as bool; - } - return Future.value(); - } - - /// Test serialization of object with outer number type - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [OuterComposite] outerComposite: - /// Input composite as post body - Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite, }) async { - // Verify required params are set. - - // ignore: prefer_const_declarations - final path = r'/fake/outer/composite'; - - // ignore: prefer_final_locals - Object postBody = outerComposite; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of object with outer number type - /// - /// Parameters: - /// - /// * [OuterComposite] outerComposite: - /// Input composite as post body - Future fakeOuterCompositeSerialize({ OuterComposite outerComposite, }) async { - final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return OuterComposite.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// Test serialization of outer number types - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [num] body: - /// Input number as post body - Future fakeOuterNumberSerializeWithHttpInfo({ num body, }) async { - // Verify required params are set. - - // ignore: prefer_const_declarations - final path = r'/fake/outer/number'; - - // ignore: prefer_final_locals - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer number types - /// - /// Parameters: - /// - /// * [num] body: - /// Input number as post body - Future fakeOuterNumberSerialize({ num body, }) async { - final response = await fakeOuterNumberSerializeWithHttpInfo( body: body, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return response.body as num; - } - return Future.value(); - } - - /// Test serialization of outer string types - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] body: - /// Input string as post body - Future fakeOuterStringSerializeWithHttpInfo({ String body, }) async { - // Verify required params are set. - - // ignore: prefer_const_declarations - final path = r'/fake/outer/string'; - - // ignore: prefer_final_locals - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of outer string types - /// - /// Parameters: - /// - /// * [String] body: - /// Input string as post body - Future fakeOuterStringSerialize({ String body, }) async { - final response = await fakeOuterStringSerializeWithHttpInfo( body: body, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return response.body as String; - } - return Future.value(); - } - - /// Test serialization of enum (int) properties with examples - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): - /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - // Verify required params are set. - if (outerObjectWithEnumProperty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/property/enum-int'; - - // ignore: prefer_final_locals - Object postBody = outerObjectWithEnumProperty; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Test serialization of enum (int) properties with examples - /// - /// Parameters: - /// - /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): - /// Input enum (int) as post body - Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { - final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return OuterObjectWithEnumProperty.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// For this test, the body has to be a binary file. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [MultipartFile] body (required): - /// image to upload - Future testBodyWithBinaryWithHttpInfo(MultipartFile body,) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/body-with-binary'; - - // ignore: prefer_final_locals - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['image/png']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// For this test, the body has to be a binary file. - /// - /// Parameters: - /// - /// * [MultipartFile] body (required): - /// image to upload - Future testBodyWithBinary(MultipartFile body,) async { - final response = await testBodyWithBinaryWithHttpInfo(body,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// For this test, the body for this request must reference a schema named `File`. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [FileSchemaTestClass] fileSchemaTestClass (required): - Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async { - // Verify required params are set. - if (fileSchemaTestClass == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/body-with-file-schema'; - - // ignore: prefer_final_locals - Object postBody = fileSchemaTestClass; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// For this test, the body for this request must reference a schema named `File`. - /// - /// Parameters: - /// - /// * [FileSchemaTestClass] fileSchemaTestClass (required): - Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { - final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. - /// Parameters: - /// - /// * [String] query (required): - /// - /// * [User] user (required): - Future testBodyWithQueryParamsWithHttpInfo(String query, User user,) async { - // Verify required params are set. - if (query == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: query'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/body-with-query-params'; - - // ignore: prefer_final_locals - Object postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query)); - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Parameters: - /// - /// * [String] query (required): - /// - /// * [User] user (required): - Future testBodyWithQueryParams(String query, User user,) async { - final response = await testBodyWithQueryParamsWithHttpInfo(query, user,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// To test \"client\" model - /// - /// To test \"client\" model - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClientModelWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test \"client\" model - /// - /// To test \"client\" model - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClientModel(ModelClient modelClient,) async { - final response = await testClientModelWithHttpInfo(modelClient,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return ModelClient.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [num] number (required): - /// None - /// - /// * [double] double_ (required): - /// None - /// - /// * [String] patternWithoutDelimiter (required): - /// None - /// - /// * [String] byte (required): - /// None - /// - /// * [int] integer: - /// None - /// - /// * [int] int32: - /// None - /// - /// * [int] int64: - /// None - /// - /// * [double] float: - /// None - /// - /// * [String] string: - /// None - /// - /// * [MultipartFile] binary: - /// None - /// - /// * [DateTime] date: - /// None - /// - /// * [DateTime] dateTime: - /// None - /// - /// * [String] password: - /// None - /// - /// * [String] callback: - /// None - Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { - // Verify required params are set. - if (number == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); - } - if (double_ == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: double_'); - } - if (patternWithoutDelimiter == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); - } - if (byte == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: byte'); - } - - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['http_basic_test']; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (integer != null) { - formParams[r'integer'] = parameterToString(integer); - } - if (int32 != null) { - formParams[r'int32'] = parameterToString(int32); - } - if (int64 != null) { - formParams[r'int64'] = parameterToString(int64); - } - if (number != null) { - formParams[r'number'] = parameterToString(number); - } - if (float != null) { - formParams[r'float'] = parameterToString(float); - } - if (double_ != null) { - formParams[r'double'] = parameterToString(double_); - } - if (string != null) { - formParams[r'string'] = parameterToString(string); - } - if (patternWithoutDelimiter != null) { - formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); - } - if (byte != null) { - formParams[r'byte'] = parameterToString(byte); - } - if (date != null) { - formParams[r'date'] = parameterToString(date); - } - if (dateTime != null) { - formParams[r'dateTime'] = parameterToString(dateTime); - } - if (password != null) { - formParams[r'password'] = parameterToString(password); - } - if (callback != null) { - formParams[r'callback'] = parameterToString(callback); - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Parameters: - /// - /// * [num] number (required): - /// None - /// - /// * [double] double_ (required): - /// None - /// - /// * [String] patternWithoutDelimiter (required): - /// None - /// - /// * [String] byte (required): - /// None - /// - /// * [int] integer: - /// None - /// - /// * [int] int32: - /// None - /// - /// * [int] int64: - /// None - /// - /// * [double] float: - /// None - /// - /// * [String] string: - /// None - /// - /// * [MultipartFile] binary: - /// None - /// - /// * [DateTime] date: - /// None - /// - /// * [DateTime] dateTime: - /// None - /// - /// * [String] password: - /// None - /// - /// * [String] callback: - /// None - Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async { - final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// To test enum parameters - /// - /// To test enum parameters - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] enumHeaderStringArray: - /// Header parameter enum test (string array) - /// - /// * [String] enumHeaderString: - /// Header parameter enum test (string) - /// - /// * [List] enumQueryStringArray: - /// Query parameter enum test (string array) - /// - /// * [String] enumQueryString: - /// Query parameter enum test (string) - /// - /// * [int] enumQueryInteger: - /// Query parameter enum test (double) - /// - /// * [double] enumQueryDouble: - /// Query parameter enum test (double) - /// - /// * [List] enumFormStringArray: - /// Form parameter enum test (string array) - /// - /// * [String] enumFormString: - /// Form parameter enum test (string) - Future testEnumParametersWithHttpInfo({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { - // Verify required params are set. - - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (enumQueryStringArray != null) { - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'enum_query_string_array', enumQueryStringArray)); - } - if (enumQueryString != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_string', enumQueryString)); - } - if (enumQueryInteger != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_integer', enumQueryInteger)); - } - if (enumQueryDouble != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_double', enumQueryDouble)); - } - - if (enumHeaderStringArray != null) { - headerParams[r'enum_header_string_array'] = parameterToString(enumHeaderStringArray); - } - if (enumHeaderString != null) { - headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); - } - - const authNames = []; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (enumFormStringArray != null) { - formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); - } - if (enumFormString != null) { - formParams[r'enum_form_string'] = parameterToString(enumFormString); - } - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test enum parameters - /// - /// To test enum parameters - /// - /// Parameters: - /// - /// * [List] enumHeaderStringArray: - /// Header parameter enum test (string array) - /// - /// * [String] enumHeaderString: - /// Header parameter enum test (string) - /// - /// * [List] enumQueryStringArray: - /// Query parameter enum test (string array) - /// - /// * [String] enumQueryString: - /// Query parameter enum test (string) - /// - /// * [int] enumQueryInteger: - /// Query parameter enum test (double) - /// - /// * [double] enumQueryDouble: - /// Query parameter enum test (double) - /// - /// * [List] enumFormStringArray: - /// Form parameter enum test (string array) - /// - /// * [String] enumFormString: - /// Form parameter enum test (string) - Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString, }) async { - final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Fake endpoint to test group parameters (optional) - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] requiredStringGroup (required): - /// Required String in group parameters - /// - /// * [bool] requiredBooleanGroup (required): - /// Required Boolean in group parameters - /// - /// * [int] requiredInt64Group (required): - /// Required Integer in group parameters - /// - /// * [int] stringGroup: - /// String in group parameters - /// - /// * [bool] booleanGroup: - /// Boolean in group parameters - /// - /// * [int] int64Group: - /// Integer in group parameters - Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { - // Verify required params are set. - if (requiredStringGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup'); - } - if (requiredBooleanGroup == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredBooleanGroup'); - } - if (requiredInt64Group == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group'); - } - - // ignore: prefer_const_declarations - final path = r'/fake'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_string_group', requiredStringGroup)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'required_int64_group', requiredInt64Group)); - if (stringGroup != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'string_group', stringGroup)); - } - if (int64Group != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'int64_group', int64Group)); - } - - headerParams[r'required_boolean_group'] = parameterToString(requiredBooleanGroup); - if (booleanGroup != null) { - headerParams[r'boolean_group'] = parameterToString(booleanGroup); - } - - const authNames = ['bearer_test']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Fake endpoint to test group parameters (optional) - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Parameters: - /// - /// * [int] requiredStringGroup (required): - /// Required String in group parameters - /// - /// * [bool] requiredBooleanGroup (required): - /// Required Boolean in group parameters - /// - /// * [int] requiredInt64Group (required): - /// Required Integer in group parameters - /// - /// * [int] stringGroup: - /// String in group parameters - /// - /// * [bool] booleanGroup: - /// Boolean in group parameters - /// - /// * [int] int64Group: - /// Integer in group parameters - Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async { - final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// test inline additionalProperties - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Map] requestBody (required): - /// request body - Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody,) async { - // Verify required params are set. - if (requestBody == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/inline-additionalProperties'; - - // ignore: prefer_final_locals - Object postBody = requestBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test inline additionalProperties - /// - /// Parameters: - /// - /// * [Map] requestBody (required): - /// request body - Future testInlineAdditionalProperties(Map requestBody,) async { - final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// test json serialization of form data - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] param (required): - /// field1 - /// - /// * [String] param2 (required): - /// field2 - Future testJsonFormDataWithHttpInfo(String param, String param2,) async { - // Verify required params are set. - if (param == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param'); - } - if (param2 == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: param2'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/jsonFormData'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (param != null) { - formParams[r'param'] = parameterToString(param); - } - if (param2 != null) { - formParams[r'param2'] = parameterToString(param2); - } - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// test json serialization of form data - /// - /// Parameters: - /// - /// * [String] param (required): - /// field1 - /// - /// * [String] param2 (required): - /// field2 - Future testJsonFormData(String param, String param2,) async { - final response = await testJsonFormDataWithHttpInfo(param, param2,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// To test the collection format in query parameters - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] pipe (required): - /// - /// * [List] ioutil (required): - /// - /// * [List] http (required): - /// - /// * [List] url (required): - /// - /// * [List] context (required): - /// - /// * [String] allowEmpty (required): - /// - /// * [Map] language: - Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { - // Verify required params are set. - if (pipe == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe'); - } - if (ioutil == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: ioutil'); - } - if (http == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: http'); - } - if (url == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: url'); - } - if (context == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: context'); - } - if (allowEmpty == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: allowEmpty'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/test-query-parameters'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('pipes', 'pipe', pipe)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'ioutil', ioutil)); - queryParams.addAll(_convertParametersForCollectionFormat('ssv', 'http', http)); - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'url', url)); - queryParams.addAll(_convertParametersForCollectionFormat('multi', 'context', context)); - if (language != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'language', language)); - } - queryParams.addAll(_convertParametersForCollectionFormat('', 'allowEmpty', allowEmpty)); - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test the collection format in query parameters - /// - /// Parameters: - /// - /// * [List] pipe (required): - /// - /// * [List] ioutil (required): - /// - /// * [List] http (required): - /// - /// * [List] url (required): - /// - /// * [List] context (required): - /// - /// * [String] allowEmpty (required): - /// - /// * [Map] language: - Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language, }) async { - final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart deleted file mode 100644 index 42639bc346e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class FakeClassnameTags123Api { - FakeClassnameTags123Api([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// To test class name in snake case - /// - /// To test class name in snake case - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClassnameWithHttpInfo(ModelClient modelClient,) async { - // Verify required params are set. - if (modelClient == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); - } - - // ignore: prefer_const_declarations - final path = r'/fake_classname_test'; - - // ignore: prefer_final_locals - Object postBody = modelClient; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key_query']; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PATCH', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// To test class name in snake case - /// - /// To test class name in snake case - /// - /// Parameters: - /// - /// * [ModelClient] modelClient (required): - /// client model - Future testClassname(ModelClient modelClient,) async { - final response = await testClassnameWithHttpInfo(modelClient,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return ModelClient.fromJson(json.decode(response.body)); - } - return Future.value(); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart deleted file mode 100644 index 398fd576224..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart +++ /dev/null @@ -1,641 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class PetApi { - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Add a new pet to the store - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future addPetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - - // ignore: prefer_const_declarations - final path = r'/pet'; - - // ignore: prefer_final_locals - Object postBody = pet; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Add a new pet to the store - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future addPet(Pet pet,) async { - final response = await addPetWithHttpInfo(pet,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Deletes a pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - Future deletePetWithHttpInfo(int petId, { String apiKey, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/{petId}' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (apiKey != null) { - headerParams[r'api_key'] = parameterToString(apiKey); - } - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Deletes a pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - Future deletePet(int petId, { String apiKey, }) async { - final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future findPetsByStatusWithHttpInfo(List status,) async { - // Verify required params are set. - if (status == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/findByStatus'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future> findPetsByStatus(List status,) async { - final response = await findPetsByStatusWithHttpInfo(status,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return (json.decode(response.body) as List) - .map((i) => Pet.fromJson(i)) - .toList(); - } - return Future>.value(); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Set] tags (required): - /// Tags to filter by - Future findPetsByTagsWithHttpInfo(Set tags,) async { - // Verify required params are set. - if (tags == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/findByTags'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); - - const authNames = ['petstore_auth']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Parameters: - /// - /// * [Set] tags (required): - /// Tags to filter by - Future> findPetsByTags(Set tags,) async { - final response = await findPetsByTagsWithHttpInfo(tags,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return (json.decode(response.body) as List) - .map((i) => Pet.fromJson(i)) - .toSet(); - } - return Future>.value(); - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetByIdWithHttpInfo(int petId,) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/{petId}' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetById(int petId,) async { - final response = await getPetByIdWithHttpInfo(petId,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return Pet.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// Update an existing pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future updatePetWithHttpInfo(Pet pet,) async { - // Verify required params are set. - if (pet == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); - } - - // ignore: prefer_const_declarations - final path = r'/pet'; - - // ignore: prefer_final_locals - Object postBody = pet; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/json', 'application/xml']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Update an existing pet - /// - /// Parameters: - /// - /// * [Pet] pet (required): - /// Pet object that needs to be added to the store - Future updatePet(Pet pet,) async { - final response = await updatePetWithHttpInfo(pet,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Updates a pet in the store with form data - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/{petId}' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['application/x-www-form-urlencoded']; - - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Updates a pet in the store with form data - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - Future updatePetWithForm(int petId, { String name, String status, }) async { - final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// uploads an image - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - // ignore: prefer_const_declarations - final path = r'/pet/{petId}/uploadImage' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['multipart/form-data']; - - bool hasFields = false; - final mp = MultipartRequest('POST', Uri.parse(path)); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// uploads an image - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async { - final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return ApiResponse.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// uploads an image (required) - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [MultipartFile] requiredFile (required): - /// file to upload - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - if (requiredFile == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile'); - } - - // ignore: prefer_const_declarations - final path = r'/fake/{petId}/uploadImageWithRequiredFile' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['petstore_auth']; - const contentTypes = ['multipart/form-data']; - - bool hasFields = false; - final mp = MultipartRequest('POST', Uri.parse(path)); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (requiredFile != null) { - hasFields = true; - mp.fields[r'requiredFile'] = requiredFile.field; - mp.files.add(requiredFile); - } - if (hasFields) { - postBody = mp; - } - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// uploads an image (required) - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [MultipartFile] requiredFile (required): - /// file to upload - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async { - final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata, ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return ApiResponse.fromJson(json.decode(response.body)); - } - return Future.value(); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart deleted file mode 100644 index 9b60b28a7e5..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart +++ /dev/null @@ -1,253 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class StoreApi { - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - Future deleteOrderWithHttpInfo(String orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - - // ignore: prefer_const_declarations - final path = r'/store/order/{order_id}' - .replaceAll('{order_id}', orderId); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - Future deleteOrder(String orderId,) async { - final response = await deleteOrderWithHttpInfo(orderId,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - /// - /// Note: This method returns the HTTP [Response]. - Future getInventoryWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/store/inventory'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = ['api_key']; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future> getInventory() async { - final response = await getInventoryWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return Map.from(json.decode(response.body)); - } - return Future>.value(); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderByIdWithHttpInfo(int orderId,) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - - // ignore: prefer_const_declarations - final path = r'/store/order/{order_id}' - .replaceAll('{order_id}', orderId.toString()); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderById(int orderId,) async { - final response = await getOrderByIdWithHttpInfo(orderId,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return Order.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// Place an order for a pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Order] order (required): - /// order placed for purchasing the pet - Future placeOrderWithHttpInfo(Order order,) async { - // Verify required params are set. - if (order == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); - } - - // ignore: prefer_const_declarations - final path = r'/store/order'; - - // ignore: prefer_final_locals - Object postBody = order; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Place an order for a pet - /// - /// Parameters: - /// - /// * [Order] order (required): - /// order placed for purchasing the pet - Future placeOrder(Order order,) async { - final response = await placeOrderWithHttpInfo(order,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return Order.fromJson(json.decode(response.body)); - } - return Future.value(); - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart deleted file mode 100644 index 2e3e0757958..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart +++ /dev/null @@ -1,479 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class UserApi { - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [User] user (required): - /// Created user object - Future createUserWithHttpInfo(User user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - - // ignore: prefer_const_declarations - final path = r'/user'; - - // ignore: prefer_final_locals - Object postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [User] user (required): - /// Created user object - Future createUser(User user,) async { - final response = await createUserWithHttpInfo(user,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Creates list of users with given input array - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithArrayInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - - // ignore: prefer_const_declarations - final path = r'/user/createWithArray'; - - // ignore: prefer_final_locals - Object postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithArrayInput(List user,) async { - final response = await createUsersWithArrayInputWithHttpInfo(user,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Creates list of users with given input array - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithListInputWithHttpInfo(List user,) async { - // Verify required params are set. - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - - // ignore: prefer_const_declarations - final path = r'/user/createWithList'; - - // ignore: prefer_final_locals - Object postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] user (required): - /// List of user object - Future createUsersWithListInput(List user,) async { - final response = await createUsersWithListInputWithHttpInfo(user,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Delete user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - Future deleteUserWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Delete user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - Future deleteUser(String username,) async { - final response = await deleteUserWithHttpInfo(username,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Get user by user name - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByNameWithHttpInfo(String username,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Get user by user name - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username,) async { - final response = await getUserByNameWithHttpInfo(username,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return User.fromJson(json.decode(response.body)); - } - return Future.value(); - } - - /// Logs user into the system - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - Future loginUserWithHttpInfo(String username, String password,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (password == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); - } - - // ignore: prefer_const_declarations - final path = r'/user/login'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Logs user into the system - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - Future loginUser(String username, String password,) async { - final response = await loginUserWithHttpInfo(username, password,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - - return response.body as String; - } - return Future.value(); - } - - /// Logs out current logged in user session - /// - /// Note: This method returns the HTTP [Response]. - Future logoutUserWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/user/logout'; - - // ignore: prefer_final_locals - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Logs out current logged in user session - Future logoutUser() async { - final response = await logoutUserWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Updated user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] user (required): - /// Updated user object - Future updateUserWithHttpInfo(String username, User user,) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (user == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); - } - - // ignore: prefer_const_declarations - final path = r'/user/{username}' - .replaceAll('{username}', username); - - // ignore: prefer_final_locals - Object postBody = user; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const authNames = []; - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes[0], - authNames, - ); - } - - /// Updated user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] user (required): - /// Updated user object - Future updateUser(String username, User user,) async { - final response = await updateUserWithHttpInfo(username, user,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart deleted file mode 100644 index 18e47e88715..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart +++ /dev/null @@ -1,173 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { - // Setup authentications (key: authentication name, value: authentication). - _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); - _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); - _authentications[r'bearer_test'] = HttpBearerAuth(); - _authentications[r'http_basic_test'] = HttpBasicAuth(); - _authentications[r'petstore_auth'] = OAuth(); - } - - final String basePath; - - var _client = Client(); - - /// Returns the current HTTP [Client] instance to use in this class. - /// - /// The return value is guaranteed to never be null. - Client get client => _client; - - /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. - set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } - _client = newClient; - } - - final _defaultHeaderMap = {}; - final _authentications = {}; - - void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; - } - - Map get defaultHeaderMap => _defaultHeaderMap; - - /// Returns an unmodifiable [Map] of the authentications, since none should be added - /// or deleted. - Map get authentications => Map.unmodifiable(_authentications); - - T getAuthentication(String name) { - final authentication = _authentications[name]; - return authentication is T ? authentication : null; - } - - // We don't use a Map for queryParams. - // If collectionFormat is 'multi', a key might appear multiple times. - Future invokeAPI( - String path, - String method, - List queryParams, - Object body, - Map headerParams, - Map formParams, - String nullableContentType, - List authNames, - ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); - - headerParams.addAll(_defaultHeaderMap); - - final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - - final uri = Uri.parse('$basePath$path$queryString'); - - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - - try { - // Special case for uploading a single file which isn't a 'multipart/form-data'. - if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) - ) { - final request = StreamedRequest(method, uri); - request.headers.addAll(headerParams); - request.contentLength = body.length; - body.finalize().listen( - request.sink.add, - onDone: request.sink.close, - // ignore: avoid_types_on_closure_parameters - onError: (Object error, StackTrace trace) => request.sink.close(), - cancelOnError: true, - ); - final response = await _client.send(request); - return Response.fromStream(response); - } - - if (body is MultipartRequest) { - final request = MultipartRequest(method, uri); - request.fields.addAll(body.fields); - request.files.addAll(body.files); - request.headers.addAll(body.headers); - request.headers.addAll(headerParams); - final response = await _client.send(request); - return Response.fromStream(response); - } - - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' - ? formParams - : await serializeAsync(body); - final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; - - switch(method) { - case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,); - case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,); - case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); - case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); - } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); - } - - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); - } - - // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); - - @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); - - /// Update query and header parameters based on authentication settings. - /// @param authNames The authentications to apply - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - for(final authName in authNames) { - final auth = _authentications[authName]; - if (auth == null) { - throw ArgumentError('Authentication undefined: $authName'); - } - auth.applyToParams(queryParams, headerParams); - } - } - -} - -/// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart deleted file mode 100644 index 8ffc340b4c9..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart +++ /dev/null @@ -1,33 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiException implements Exception { - ApiException(this.code, this.message); - - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); - - int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; - - @override - String toString() { - if (message == null) { - return 'ApiException'; - } - if (innerException == null) { - return 'ApiException $code: $message'; - } - return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart deleted file mode 100644 index e2ffc78abb7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart +++ /dev/null @@ -1,121 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class QueryParam { - const QueryParam(this.name, this.value); - - final String name; - final String value; - - @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; -} - -// Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, - dynamic value, -) { - final params = []; - - // preconditions - if (name != null && name.isNotEmpty && value != null) { - if (value is List) { - if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); - } - - // Default collection format is 'csv'. - if (collectionFormat == null || collectionFormat.isEmpty) { - // ignore: parameter_assignments - collectionFormat = 'csv'; - } - - final delimiter = _delimiters[collectionFormat] ?? ','; - - params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),); - } else { - params.add(QueryParam(name, parameterToString(value),)); - } - } - - return params; -} - -/// Format the given parameter object into a [String]. -String parameterToString(dynamic value) { - if (value == null) { - return ''; - } - if (value is DateTime) { - return value.toUtc().toIso8601String(); - } - if (value is EnumClass) { - return value.toString(); - } - if (value is OuterEnum) { - return value.toString(); - } - if (value is OuterEnumDefaultValue) { - return value.toString(); - } - if (value is OuterEnumInteger) { - return value.toString(); - } - if (value is OuterEnumIntegerDefaultValue) { - return value.toString(); - } - return value.toString(); -} - -/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' -/// content type. Otherwise, returns the decoded body as decoded by dart:http package. -Future _decodeBodyBytes(Response response) async { - final contentType = response.headers['content-type']; - return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) - : response.body; -} - -/// Returns a valid [T] value found at the specified Map [key], null otherwise. -T mapValueOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is T ? value : null; -} - -/// Returns a valid Map found at the specified Map [key], null otherwise. -Map mapCastOfType(dynamic map, String key) { - final dynamic value = map is Map ? map[key] : null; - return value is Map ? value.cast() : null; -} - -/// Returns a valid [DateTime] found at the specified Map [key], null otherwise. -DateTime mapDateTime(dynamic map, String key, [String pattern]) { - final dynamic value = map is Map ? map[key] : null; - if (value != null) { - int millis; - if (value is int) { - millis = value; - } else if (value is String) { - if (pattern == _dateEpochMarker) { - millis = int.tryParse(value); - } else { - return DateTime.tryParse(value); - } - } - if (millis != null) { - return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); - } - } - return null; -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart deleted file mode 100644 index 0c2303af09e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart +++ /dev/null @@ -1,38 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiKeyAuth implements Authentication { - ApiKeyAuth(this.location, this.paramName); - - final String location; - final String paramName; - - String apiKeyPrefix; - String apiKey; - - @override - void applyToParams(List queryParams, Map headerParams) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update( - 'Cookie', - (existingCookie) => '$existingCookie; $paramName=$value', - ifAbsent: () => '$paramName=$value', - ); - } - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart deleted file mode 100644 index 4257e190006..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -// ignore: one_member_abstracts -abstract class Authentication { - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart deleted file mode 100644 index 0494f402d95..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart +++ /dev/null @@ -1,22 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class HttpBasicAuth implements Authentication { - String username; - String password; - - @override - void applyToParams(List queryParams, Map headerParams) { - final credentials = '${username ?? ''}:${password ?? ''}'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart deleted file mode 100644 index 23e243523dd..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart +++ /dev/null @@ -1,39 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -typedef HttpBearerAuthProvider = String Function(); - -class HttpBearerAuth implements Authentication { - HttpBearerAuth(); - - dynamic _accessToken; - - dynamic get accessToken => _accessToken; - - set accessToken(dynamic accessToken) { - if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - _accessToken = accessToken; - } - - @override - void applyToParams(List queryParams, Map headerParams) { - if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; - } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; - } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart deleted file mode 100644 index 9299ac13f5b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart +++ /dev/null @@ -1,24 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class OAuth implements Authentication { - OAuth({this.accessToken}); - - String accessToken; - - @override - void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams['Authorization'] = 'Bearer $accessToken'; - } - } -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart deleted file mode 100644 index de1ac810d59..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class AdditionalPropertiesClass { - /// Returns a new [AdditionalPropertiesClass] instance. - AdditionalPropertiesClass({ - this.mapProperty = const {}, - this.mapOfMapProperty = const {}, - }); - - @JsonKey( - defaultValue: const {}, - name: r'map_property', - required: false, - ) - Map mapProperty; - - @JsonKey( - defaultValue: const {}, - name: r'map_of_map_property', - required: false, - ) - Map> mapOfMapProperty; - - @override - bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && - other.mapProperty == mapProperty && - other.mapOfMapProperty == mapOfMapProperty; - - @override - int get hashCode => - (mapProperty == null ? 0 : mapProperty.hashCode) + - (mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode); - - factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); - - Map toJson() => _$AdditionalPropertiesClassToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart deleted file mode 100644 index 8d4772ba251..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Animal { - /// Returns a new [Animal] instance. - Animal({ - @required this.className, - this.color = 'red', - }); - - @JsonKey( - nullable: false, - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String color; - - @override - bool operator ==(Object other) => identical(this, other) || other is Animal && - other.className == className && - other.color == color; - - @override - int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode); - - factory Animal.fromJson(Map json) => _$AnimalFromJson(json); - - Map toJson() => _$AnimalToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart deleted file mode 100644 index 24516bbcb1c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ApiResponse { - /// Returns a new [ApiResponse] instance. - ApiResponse({ - this.code, - this.type, - this.message, - }); - - @JsonKey( - nullable: false, - name: r'code', - required: false, - ) - int code; - - @JsonKey( - nullable: false, - name: r'type', - required: false, - ) - String type; - - @JsonKey( - nullable: false, - name: r'message', - required: false, - ) - String message; - - @override - bool operator ==(Object other) => identical(this, other) || other is ApiResponse && - other.code == code && - other.type == type && - other.message == message; - - @override - int get hashCode => - (code == null ? 0 : code.hashCode) + - (type == null ? 0 : type.hashCode) + - (message == null ? 0 : message.hashCode); - - factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); - - Map toJson() => _$ApiResponseToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart deleted file mode 100644 index 7d7d2d004ef..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayOfArrayOfNumberOnly { - /// Returns a new [ArrayOfArrayOfNumberOnly] instance. - ArrayOfArrayOfNumberOnly({ - this.arrayArrayNumber = const [], - }); - - @JsonKey( - defaultValue: const [], - name: r'ArrayArrayNumber', - required: false, - ) - List> arrayArrayNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && - other.arrayArrayNumber == arrayArrayNumber; - - @override - int get hashCode => - (arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode); - - factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); - - Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart deleted file mode 100644 index 27bea05339d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayOfNumberOnly { - /// Returns a new [ArrayOfNumberOnly] instance. - ArrayOfNumberOnly({ - this.arrayNumber = const [], - }); - - @JsonKey( - defaultValue: const [], - name: r'ArrayNumber', - required: false, - ) - List arrayNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && - other.arrayNumber == arrayNumber; - - @override - int get hashCode => - (arrayNumber == null ? 0 : arrayNumber.hashCode); - - factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); - - Map toJson() => _$ArrayOfNumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart deleted file mode 100644 index 03656ce5fbc..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ArrayTest { - /// Returns a new [ArrayTest] instance. - ArrayTest({ - this.arrayOfString = const [], - this.arrayArrayOfInteger = const [], - this.arrayArrayOfModel = const [], - }); - - @JsonKey( - defaultValue: const [], - name: r'array_of_string', - required: false, - ) - List arrayOfString; - - @JsonKey( - defaultValue: const [], - name: r'array_array_of_integer', - required: false, - ) - List> arrayArrayOfInteger; - - @JsonKey( - defaultValue: const [], - name: r'array_array_of_model', - required: false, - ) - List> arrayArrayOfModel; - - @override - bool operator ==(Object other) => identical(this, other) || other is ArrayTest && - other.arrayOfString == arrayOfString && - other.arrayArrayOfInteger == arrayArrayOfInteger && - other.arrayArrayOfModel == arrayArrayOfModel; - - @override - int get hashCode => - (arrayOfString == null ? 0 : arrayOfString.hashCode) + - (arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) + - (arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode); - - factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); - - Map toJson() => _$ArrayTestToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart deleted file mode 100644 index bb906c2c45e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart +++ /dev/null @@ -1,98 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Capitalization { - /// Returns a new [Capitalization] instance. - Capitalization({ - this.smallCamel, - this.capitalCamel, - this.smallSnake, - this.capitalSnake, - this.sCAETHFlowPoints, - this.ATT_NAME, - }); - - @JsonKey( - nullable: false, - name: r'smallCamel', - required: false, - ) - String smallCamel; - - @JsonKey( - nullable: false, - name: r'CapitalCamel', - required: false, - ) - String capitalCamel; - - @JsonKey( - nullable: false, - name: r'small_Snake', - required: false, - ) - String smallSnake; - - @JsonKey( - nullable: false, - name: r'Capital_Snake', - required: false, - ) - String capitalSnake; - - @JsonKey( - nullable: false, - name: r'SCA_ETH_Flow_Points', - required: false, - ) - String sCAETHFlowPoints; - - /// Name of the pet - @JsonKey( - nullable: false, - name: r'ATT_NAME', - required: false, - ) - String ATT_NAME; - - @override - bool operator ==(Object other) => identical(this, other) || other is Capitalization && - other.smallCamel == smallCamel && - other.capitalCamel == capitalCamel && - other.smallSnake == smallSnake && - other.capitalSnake == capitalSnake && - other.sCAETHFlowPoints == sCAETHFlowPoints && - other.ATT_NAME == ATT_NAME; - - @override - int get hashCode => - (smallCamel == null ? 0 : smallCamel.hashCode) + - (capitalCamel == null ? 0 : capitalCamel.hashCode) + - (smallSnake == null ? 0 : smallSnake.hashCode) + - (capitalSnake == null ? 0 : capitalSnake.hashCode) + - (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints.hashCode) + - (ATT_NAME == null ? 0 : ATT_NAME.hashCode); - - factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); - - Map toJson() => _$CapitalizationToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart deleted file mode 100644 index 479cf62f2cd..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Cat { - /// Returns a new [Cat] instance. - Cat({ - @required this.className, - this.color = 'red', - this.declawed, - }); - - @JsonKey( - nullable: false, - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String color; - - @JsonKey( - nullable: false, - name: r'declawed', - required: false, - ) - bool declawed; - - @override - bool operator ==(Object other) => identical(this, other) || other is Cat && - other.className == className && - other.color == color && - other.declawed == declawed; - - @override - int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (declawed == null ? 0 : declawed.hashCode); - - factory Cat.fromJson(Map json) => _$CatFromJson(json); - - Map toJson() => _$CatToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart deleted file mode 100644 index e3ca59d3b37..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class CatAllOf { - /// Returns a new [CatAllOf] instance. - CatAllOf({ - this.declawed, - }); - - @JsonKey( - nullable: false, - name: r'declawed', - required: false, - ) - bool declawed; - - @override - bool operator ==(Object other) => identical(this, other) || other is CatAllOf && - other.declawed == declawed; - - @override - int get hashCode => - (declawed == null ? 0 : declawed.hashCode); - - factory CatAllOf.fromJson(Map json) => _$CatAllOfFromJson(json); - - Map toJson() => _$CatAllOfToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart deleted file mode 100644 index 1275e305b82..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Category { - /// Returns a new [Category] instance. - Category({ - this.id, - this.name = 'default-name', - }); - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - int id; - - @JsonKey( - defaultValue: 'default-name', - name: r'name', - required: true, - ) - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Category && - other.id == id && - other.name == name; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); - - factory Category.fromJson(Map json) => _$CategoryFromJson(json); - - Map toJson() => _$CategoryToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart deleted file mode 100644 index fc2d7534ce7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ClassModel { - /// Returns a new [ClassModel] instance. - ClassModel({ - this.class_, - }); - - @JsonKey( - nullable: false, - name: r'_class', - required: false, - ) - String class_; - - @override - bool operator ==(Object other) => identical(this, other) || other is ClassModel && - other.class_ == class_; - - @override - int get hashCode => - (class_ == null ? 0 : class_.hashCode); - - factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); - - Map toJson() => _$ClassModelToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart deleted file mode 100644 index 945fbc85e1f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/deprecated_object.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class DeprecatedObject { - /// Returns a new [DeprecatedObject] instance. - DeprecatedObject({ - this.name, - }); - - @JsonKey( - nullable: false, - name: r'name', - required: false, - ) - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && - other.name == name; - - @override - int get hashCode => - (name == null ? 0 : name.hashCode); - - factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); - - Map toJson() => _$DeprecatedObjectToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart deleted file mode 100644 index 8b8d1d36a04..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Dog { - /// Returns a new [Dog] instance. - Dog({ - @required this.className, - this.color = 'red', - this.breed, - }); - - @JsonKey( - nullable: false, - name: r'className', - required: true, - ) - String className; - - @JsonKey( - defaultValue: 'red', - name: r'color', - required: false, - ) - String color; - - @JsonKey( - nullable: false, - name: r'breed', - required: false, - ) - String breed; - - @override - bool operator ==(Object other) => identical(this, other) || other is Dog && - other.className == className && - other.color == color && - other.breed == breed; - - @override - int get hashCode => - (className == null ? 0 : className.hashCode) + - (color == null ? 0 : color.hashCode) + - (breed == null ? 0 : breed.hashCode); - - factory Dog.fromJson(Map json) => _$DogFromJson(json); - - Map toJson() => _$DogToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart deleted file mode 100644 index 0a2672d908a..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class DogAllOf { - /// Returns a new [DogAllOf] instance. - DogAllOf({ - this.breed, - }); - - @JsonKey( - nullable: false, - name: r'breed', - required: false, - ) - String breed; - - @override - bool operator ==(Object other) => identical(this, other) || other is DogAllOf && - other.breed == breed; - - @override - int get hashCode => - (breed == null ? 0 : breed.hashCode); - - factory DogAllOf.fromJson(Map json) => _$DogAllOfFromJson(json); - - Map toJson() => _$DogAllOfToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart deleted file mode 100644 index f1eb8b7d367..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart +++ /dev/null @@ -1,69 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class EnumArrays { - /// Returns a new [EnumArrays] instance. - EnumArrays({ - this.justSymbol, - this.arrayEnum = const [], - }); - - @JsonKey( - nullable: false, - name: r'just_symbol', - required: false, - ) - EnumArraysJustSymbolEnum justSymbol; - - @JsonKey( - defaultValue: const [], - name: r'array_enum', - required: false, - ) - List arrayEnum; - - @override - bool operator ==(Object other) => identical(this, other) || other is EnumArrays && - other.justSymbol == justSymbol && - other.arrayEnum == arrayEnum; - - @override - int get hashCode => - (justSymbol == null ? 0 : justSymbol.hashCode) + - (arrayEnum == null ? 0 : arrayEnum.hashCode); - - factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); - - Map toJson() => _$EnumArraysToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum EnumArraysJustSymbolEnum { - greaterThanEqual, - dollar, -} - - -enum EnumArraysArrayEnumEnum { - fish, - crab, -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart deleted file mode 100644 index 37273211efc..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum EnumClass { - abc, - efg, - leftParenthesisXyzRightParenthesis, -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart deleted file mode 100644 index 27d07a985e2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart +++ /dev/null @@ -1,143 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class EnumTest { - /// Returns a new [EnumTest] instance. - EnumTest({ - this.enumString, - @required this.enumStringRequired, - this.enumInteger, - this.enumNumber, - this.outerEnum, - this.outerEnumInteger, - this.outerEnumDefaultValue, - this.outerEnumIntegerDefaultValue, - }); - - @JsonKey( - nullable: false, - name: r'enum_string', - required: false, - ) - EnumTestEnumStringEnum enumString; - - @JsonKey( - nullable: false, - name: r'enum_string_required', - required: true, - ) - EnumTestEnumStringRequiredEnum enumStringRequired; - - @JsonKey( - nullable: false, - name: r'enum_integer', - required: false, - ) - EnumTestEnumIntegerEnum enumInteger; - - @JsonKey( - nullable: false, - name: r'enum_number', - required: false, - ) - EnumTestEnumNumberEnum enumNumber; - - @JsonKey( - nullable: true, - name: r'outerEnum', - required: false, - ) - OuterEnum outerEnum; - - @JsonKey( - nullable: false, - name: r'outerEnumInteger', - required: false, - ) - OuterEnumInteger outerEnumInteger; - - @JsonKey( - nullable: false, - name: r'outerEnumDefaultValue', - required: false, - ) - OuterEnumDefaultValue outerEnumDefaultValue; - - @JsonKey( - nullable: false, - name: r'outerEnumIntegerDefaultValue', - required: false, - ) - OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue; - - @override - bool operator ==(Object other) => identical(this, other) || other is EnumTest && - other.enumString == enumString && - other.enumStringRequired == enumStringRequired && - other.enumInteger == enumInteger && - other.enumNumber == enumNumber && - other.outerEnum == outerEnum && - other.outerEnumInteger == outerEnumInteger && - other.outerEnumDefaultValue == outerEnumDefaultValue && - other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; - - @override - int get hashCode => - (enumString == null ? 0 : enumString.hashCode) + - (enumStringRequired == null ? 0 : enumStringRequired.hashCode) + - (enumInteger == null ? 0 : enumInteger.hashCode) + - (enumNumber == null ? 0 : enumNumber.hashCode) + - (outerEnum == null ? 0 : outerEnum.hashCode) + - (outerEnumInteger == null ? 0 : outerEnumInteger.hashCode) + - (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue.hashCode) + - (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue.hashCode); - - factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); - - Map toJson() => _$EnumTestToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum EnumTestEnumStringEnum { - UPPER, - lower, - empty, -} - - -enum EnumTestEnumStringRequiredEnum { - UPPER, - lower, - empty, -} - - -enum EnumTestEnumIntegerEnum { - number1, - numberNegative1, -} - - -enum EnumTestEnumNumberEnum { - number1Period1, - numberNegative1Period2, -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart deleted file mode 100644 index 15a0b8d7daa..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class FileSchemaTestClass { - /// Returns a new [FileSchemaTestClass] instance. - FileSchemaTestClass({ - this.file, - this.files = const [], - }); - - @JsonKey( - nullable: false, - name: r'file', - required: false, - ) - ModelFile file; - - @JsonKey( - defaultValue: const [], - name: r'files', - required: false, - ) - List files; - - @override - bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && - other.file == file && - other.files == files; - - @override - int get hashCode => - (file == null ? 0 : file.hashCode) + - (files == null ? 0 : files.hashCode); - - factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); - - Map toJson() => _$FileSchemaTestClassToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart deleted file mode 100644 index a2917b7c2e8..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Foo { - /// Returns a new [Foo] instance. - Foo({ - this.bar = 'bar', - }); - - @JsonKey( - defaultValue: 'bar', - name: r'bar', - required: false, - ) - String bar; - - @override - bool operator ==(Object other) => identical(this, other) || other is Foo && - other.bar == bar; - - @override - int get hashCode => - (bar == null ? 0 : bar.hashCode); - - factory Foo.fromJson(Map json) => _$FooFromJson(json); - - Map toJson() => _$FooToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart deleted file mode 100644 index 6c66d928175..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart +++ /dev/null @@ -1,205 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class FormatTest { - /// Returns a new [FormatTest] instance. - FormatTest({ - this.integer, - this.int32, - this.int64, - @required this.number, - this.float, - this.double_, - this.decimal, - this.string, - @required this.byte, - this.binary, - @required this.date, - this.dateTime, - this.uuid, - @required this.password, - this.patternWithDigits, - this.patternWithDigitsAndDelimiter, - }); - - // minimum: 10 - // maximum: 100 - @JsonKey( - nullable: false, - name: r'integer', - required: false, - ) - int integer; - - // minimum: 20 - // maximum: 200 - @JsonKey( - nullable: false, - name: r'int32', - required: false, - ) - int int32; - - @JsonKey( - nullable: false, - name: r'int64', - required: false, - ) - int int64; - - // minimum: 32.1 - // maximum: 543.2 - @JsonKey( - nullable: false, - name: r'number', - required: true, - ) - num number; - - // minimum: 54.3 - // maximum: 987.6 - @JsonKey( - nullable: false, - name: r'float', - required: false, - ) - double float; - - // minimum: 67.8 - // maximum: 123.4 - @JsonKey( - nullable: false, - name: r'double', - required: false, - ) - double double_; - - @JsonKey( - nullable: false, - name: r'decimal', - required: false, - ) - double decimal; - - @JsonKey( - nullable: false, - name: r'string', - required: false, - ) - String string; - - @JsonKey( - nullable: false, - name: r'byte', - required: true, - ) - String byte; - - @JsonKey(ignore: true) - MultipartFile binary; - - @JsonKey( - nullable: false, - name: r'date', - required: true, - ) - DateTime date; - - @JsonKey( - nullable: false, - name: r'dateTime', - required: false, - ) - DateTime dateTime; - - @JsonKey( - nullable: false, - name: r'uuid', - required: false, - ) - String uuid; - - @JsonKey( - nullable: false, - name: r'password', - required: true, - ) - String password; - - /// A string that is a 10 digit number. Can have leading zeros. - @JsonKey( - nullable: false, - name: r'pattern_with_digits', - required: false, - ) - String patternWithDigits; - - /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - @JsonKey( - nullable: false, - name: r'pattern_with_digits_and_delimiter', - required: false, - ) - String patternWithDigitsAndDelimiter; - - @override - bool operator ==(Object other) => identical(this, other) || other is FormatTest && - other.integer == integer && - other.int32 == int32 && - other.int64 == int64 && - other.number == number && - other.float == float && - other.double_ == double_ && - other.decimal == decimal && - other.string == string && - other.byte == byte && - other.binary == binary && - other.date == date && - other.dateTime == dateTime && - other.uuid == uuid && - other.password == password && - other.patternWithDigits == patternWithDigits && - other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; - - @override - int get hashCode => - (integer == null ? 0 : integer.hashCode) + - (int32 == null ? 0 : int32.hashCode) + - (int64 == null ? 0 : int64.hashCode) + - (number == null ? 0 : number.hashCode) + - (float == null ? 0 : float.hashCode) + - (double_ == null ? 0 : double_.hashCode) + - (decimal == null ? 0 : decimal.hashCode) + - (string == null ? 0 : string.hashCode) + - (byte == null ? 0 : byte.hashCode) + - (binary == null ? 0 : binary.hashCode) + - (date == null ? 0 : date.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (uuid == null ? 0 : uuid.hashCode) + - (password == null ? 0 : password.hashCode) + - (patternWithDigits == null ? 0 : patternWithDigits.hashCode) + - (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); - - factory FormatTest.fromJson(Map json) => _$FormatTestFromJson(json); - - Map toJson() => _$FormatTestToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart deleted file mode 100644 index 5d016561de7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class HasOnlyReadOnly { - /// Returns a new [HasOnlyReadOnly] instance. - HasOnlyReadOnly({ - this.bar, - this.foo, - }); - - @JsonKey( - nullable: false, - name: r'bar', - required: false, - ) - String bar; - - @JsonKey( - nullable: false, - name: r'foo', - required: false, - ) - String foo; - - @override - bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && - other.bar == bar && - other.foo == foo; - - @override - int get hashCode => - (bar == null ? 0 : bar.hashCode) + - (foo == null ? 0 : foo.hashCode); - - factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); - - Map toJson() => _$HasOnlyReadOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart deleted file mode 100644 index eaa93075b46..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class HealthCheckResult { - /// Returns a new [HealthCheckResult] instance. - HealthCheckResult({ - this.nullableMessage, - }); - - @JsonKey( - nullable: true, - name: r'NullableMessage', - required: false, - ) - String nullableMessage; - - @override - bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && - other.nullableMessage == nullableMessage; - - @override - int get hashCode => - (nullableMessage == null ? 0 : nullableMessage.hashCode); - - factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); - - Map toJson() => _$HealthCheckResultToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart deleted file mode 100644 index 55baf510408..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class InlineResponseDefault { - /// Returns a new [InlineResponseDefault] instance. - InlineResponseDefault({ - this.string, - }); - - @JsonKey( - nullable: false, - name: r'string', - required: false, - ) - Foo string; - - @override - bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && - other.string == string; - - @override - int get hashCode => - (string == null ? 0 : string.hashCode); - - factory InlineResponseDefault.fromJson(Map json) => _$InlineResponseDefaultFromJson(json); - - Map toJson() => _$InlineResponseDefaultToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart deleted file mode 100644 index 3c06f1815f7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class MapTest { - /// Returns a new [MapTest] instance. - MapTest({ - this.mapMapOfString = const {}, - this.mapOfEnumString = const {}, - this.directMap = const {}, - this.indirectMap = const {}, - }); - - @JsonKey( - defaultValue: const {}, - name: r'map_map_of_string', - required: false, - ) - Map> mapMapOfString; - - @JsonKey( - defaultValue: const {}, - name: r'map_of_enum_string', - required: false, - ) - Map mapOfEnumString; - - @JsonKey( - defaultValue: const {}, - name: r'direct_map', - required: false, - ) - Map directMap; - - @JsonKey( - defaultValue: const {}, - name: r'indirect_map', - required: false, - ) - Map indirectMap; - - @override - bool operator ==(Object other) => identical(this, other) || other is MapTest && - other.mapMapOfString == mapMapOfString && - other.mapOfEnumString == mapOfEnumString && - other.directMap == directMap && - other.indirectMap == indirectMap; - - @override - int get hashCode => - (mapMapOfString == null ? 0 : mapMapOfString.hashCode) + - (mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) + - (directMap == null ? 0 : directMap.hashCode) + - (indirectMap == null ? 0 : indirectMap.hashCode); - - factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); - - Map toJson() => _$MapTestToJson(this); - - @override - String toString() => toJson().toString(); -} - - -enum MapTestMapOfEnumStringEnum { - UPPER, - lower, -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart deleted file mode 100644 index 1fd6acc5160..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class MixedPropertiesAndAdditionalPropertiesClass { - /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. - MixedPropertiesAndAdditionalPropertiesClass({ - this.uuid, - this.dateTime, - this.map = const {}, - }); - - @JsonKey( - nullable: false, - name: r'uuid', - required: false, - ) - String uuid; - - @JsonKey( - nullable: false, - name: r'dateTime', - required: false, - ) - DateTime dateTime; - - @JsonKey( - defaultValue: const {}, - name: r'map', - required: false, - ) - Map map; - - @override - bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && - other.uuid == uuid && - other.dateTime == dateTime && - other.map == map; - - @override - int get hashCode => - (uuid == null ? 0 : uuid.hashCode) + - (dateTime == null ? 0 : dateTime.hashCode) + - (map == null ? 0 : map.hashCode); - - factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); - - Map toJson() => _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart deleted file mode 100644 index a1c8996439b..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Model200Response { - /// Returns a new [Model200Response] instance. - Model200Response({ - this.name, - this.class_, - }); - - @JsonKey( - nullable: false, - name: r'name', - required: false, - ) - int name; - - @JsonKey( - nullable: false, - name: r'class', - required: false, - ) - String class_; - - @override - bool operator ==(Object other) => identical(this, other) || other is Model200Response && - other.name == name && - other.class_ == class_; - - @override - int get hashCode => - (name == null ? 0 : name.hashCode) + - (class_ == null ? 0 : class_.hashCode); - - factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); - - Map toJson() => _$Model200ResponseToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart deleted file mode 100644 index 70e3a6ebeb8..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelClient { - /// Returns a new [ModelClient] instance. - ModelClient({ - this.client, - }); - - @JsonKey( - nullable: false, - name: r'client', - required: false, - ) - String client; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelClient && - other.client == client; - - @override - int get hashCode => - (client == null ? 0 : client.hashCode); - - factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); - - Map toJson() => _$ModelClientToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart deleted file mode 100644 index 6fb382ebf1c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelFile { - /// Returns a new [ModelFile] instance. - ModelFile({ - this.sourceURI, - }); - - /// Test capitalization - @JsonKey( - nullable: false, - name: r'sourceURI', - required: false, - ) - String sourceURI; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelFile && - other.sourceURI == sourceURI; - - @override - int get hashCode => - (sourceURI == null ? 0 : sourceURI.hashCode); - - factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); - - Map toJson() => _$ModelFileToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart deleted file mode 100644 index b69abf130f5..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelList { - /// Returns a new [ModelList] instance. - ModelList({ - this.n123list, - }); - - @JsonKey( - nullable: false, - name: r'123-list', - required: false, - ) - String n123list; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelList && - other.n123list == n123list; - - @override - int get hashCode => - (n123list == null ? 0 : n123list.hashCode); - - factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); - - Map toJson() => _$ModelListToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart deleted file mode 100644 index 0a18d3ed489..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ModelReturn { - /// Returns a new [ModelReturn] instance. - ModelReturn({ - this.return_, - }); - - @JsonKey( - nullable: false, - name: r'return', - required: false, - ) - int return_; - - @override - bool operator ==(Object other) => identical(this, other) || other is ModelReturn && - other.return_ == return_; - - @override - int get hashCode => - (return_ == null ? 0 : return_.hashCode); - - factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); - - Map toJson() => _$ModelReturnToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart deleted file mode 100644 index c554627bfcd..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Name { - /// Returns a new [Name] instance. - Name({ - @required this.name, - this.snakeCase, - this.property, - this.n123number, - }); - - @JsonKey( - nullable: false, - name: r'name', - required: true, - ) - int name; - - @JsonKey( - nullable: false, - name: r'snake_case', - required: false, - ) - int snakeCase; - - @JsonKey( - nullable: false, - name: r'property', - required: false, - ) - String property; - - @JsonKey( - nullable: false, - name: r'123Number', - required: false, - ) - int n123number; - - @override - bool operator ==(Object other) => identical(this, other) || other is Name && - other.name == name && - other.snakeCase == snakeCase && - other.property == property && - other.n123number == n123number; - - @override - int get hashCode => - (name == null ? 0 : name.hashCode) + - (snakeCase == null ? 0 : snakeCase.hashCode) + - (property == null ? 0 : property.hashCode) + - (n123number == null ? 0 : n123number.hashCode); - - factory Name.fromJson(Map json) => _$NameFromJson(json); - - Map toJson() => _$NameToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart deleted file mode 100644 index 68c0deefc5a..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart +++ /dev/null @@ -1,157 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class NullableClass { - /// Returns a new [NullableClass] instance. - NullableClass({ - this.integerProp, - this.numberProp, - this.booleanProp, - this.stringProp, - this.dateProp, - this.datetimeProp, - this.arrayNullableProp, - this.arrayAndItemsNullableProp, - this.arrayItemsNullable = const [], - this.objectNullableProp, - this.objectAndItemsNullableProp, - this.objectItemsNullable = const {}, - }); - - @JsonKey( - nullable: true, - name: r'integer_prop', - required: false, - ) - int integerProp; - - @JsonKey( - nullable: true, - name: r'number_prop', - required: false, - ) - num numberProp; - - @JsonKey( - nullable: true, - name: r'boolean_prop', - required: false, - ) - bool booleanProp; - - @JsonKey( - nullable: true, - name: r'string_prop', - required: false, - ) - String stringProp; - - @JsonKey( - nullable: true, - name: r'date_prop', - required: false, - ) - DateTime dateProp; - - @JsonKey( - nullable: true, - name: r'datetime_prop', - required: false, - ) - DateTime datetimeProp; - - @JsonKey( - defaultValue: const [], - name: r'array_nullable_prop', - required: false, - ) - List arrayNullableProp; - - @JsonKey( - defaultValue: const [], - name: r'array_and_items_nullable_prop', - required: false, - ) - List arrayAndItemsNullableProp; - - @JsonKey( - defaultValue: const [], - name: r'array_items_nullable', - required: false, - ) - List arrayItemsNullable; - - @JsonKey( - defaultValue: const {}, - name: r'object_nullable_prop', - required: false, - ) - Map objectNullableProp; - - @JsonKey( - defaultValue: const {}, - name: r'object_and_items_nullable_prop', - required: false, - ) - Map objectAndItemsNullableProp; - - @JsonKey( - defaultValue: const {}, - name: r'object_items_nullable', - required: false, - ) - Map objectItemsNullable; - - @override - bool operator ==(Object other) => identical(this, other) || other is NullableClass && - other.integerProp == integerProp && - other.numberProp == numberProp && - other.booleanProp == booleanProp && - other.stringProp == stringProp && - other.dateProp == dateProp && - other.datetimeProp == datetimeProp && - other.arrayNullableProp == arrayNullableProp && - other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && - other.arrayItemsNullable == arrayItemsNullable && - other.objectNullableProp == objectNullableProp && - other.objectAndItemsNullableProp == objectAndItemsNullableProp && - other.objectItemsNullable == objectItemsNullable; - - @override - int get hashCode => - (integerProp == null ? 0 : integerProp.hashCode) + - (numberProp == null ? 0 : numberProp.hashCode) + - (booleanProp == null ? 0 : booleanProp.hashCode) + - (stringProp == null ? 0 : stringProp.hashCode) + - (dateProp == null ? 0 : dateProp.hashCode) + - (datetimeProp == null ? 0 : datetimeProp.hashCode) + - (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + - (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + - (arrayItemsNullable == null ? 0 : arrayItemsNullable.hashCode) + - (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + - (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + - (objectItemsNullable == null ? 0 : objectItemsNullable.hashCode); - - factory NullableClass.fromJson(Map json) => _$NullableClassFromJson(json); - - Map toJson() => _$NullableClassToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart deleted file mode 100644 index deccb0c854d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class NumberOnly { - /// Returns a new [NumberOnly] instance. - NumberOnly({ - this.justNumber, - }); - - @JsonKey( - nullable: false, - name: r'JustNumber', - required: false, - ) - num justNumber; - - @override - bool operator ==(Object other) => identical(this, other) || other is NumberOnly && - other.justNumber == justNumber; - - @override - int get hashCode => - (justNumber == null ? 0 : justNumber.hashCode); - - factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); - - Map toJson() => _$NumberOnlyToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart deleted file mode 100644 index 936ecc671f8..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/object_with_deprecated_fields.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ObjectWithDeprecatedFields { - /// Returns a new [ObjectWithDeprecatedFields] instance. - ObjectWithDeprecatedFields({ - this.uuid, - this.id, - this.deprecatedRef, - this.bars = const [], - }); - - @JsonKey( - nullable: false, - name: r'uuid', - required: false, - ) - String uuid; - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - num id; - - @JsonKey( - nullable: false, - name: r'deprecatedRef', - required: false, - ) - DeprecatedObject deprecatedRef; - - @JsonKey( - defaultValue: const [], - name: r'bars', - required: false, - ) - List bars; - - @override - bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && - other.uuid == uuid && - other.id == id && - other.deprecatedRef == deprecatedRef && - other.bars == bars; - - @override - int get hashCode => - (uuid == null ? 0 : uuid.hashCode) + - (id == null ? 0 : id.hashCode) + - (deprecatedRef == null ? 0 : deprecatedRef.hashCode) + - (bars == null ? 0 : bars.hashCode); - - factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); - - Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart deleted file mode 100644 index 096ccfe4b4e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart +++ /dev/null @@ -1,105 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Order { - /// Returns a new [Order] instance. - Order({ - this.id, - this.petId, - this.quantity, - this.shipDate, - this.status, - this.complete = false, - }); - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - int id; - - @JsonKey( - nullable: false, - name: r'petId', - required: false, - ) - int petId; - - @JsonKey( - nullable: false, - name: r'quantity', - required: false, - ) - int quantity; - - @JsonKey( - nullable: false, - name: r'shipDate', - required: false, - ) - DateTime shipDate; - - /// Order Status - @JsonKey( - nullable: false, - name: r'status', - required: false, - ) - OrderStatusEnum status; - - @JsonKey( - defaultValue: false, - name: r'complete', - required: false, - ) - bool complete; - - @override - bool operator ==(Object other) => identical(this, other) || other is Order && - other.id == id && - other.petId == petId && - other.quantity == quantity && - other.shipDate == shipDate && - other.status == status && - other.complete == complete; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (petId == null ? 0 : petId.hashCode) + - (quantity == null ? 0 : quantity.hashCode) + - (shipDate == null ? 0 : shipDate.hashCode) + - (status == null ? 0 : status.hashCode) + - (complete == null ? 0 : complete.hashCode); - - factory Order.fromJson(Map json) => _$OrderFromJson(json); - - Map toJson() => _$OrderToJson(this); - - @override - String toString() => toJson().toString(); -} - -/// Order Status -enum OrderStatusEnum { - placed, - approved, - delivered, -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart deleted file mode 100644 index 2f2bd6f221e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class OuterComposite { - /// Returns a new [OuterComposite] instance. - OuterComposite({ - this.myNumber, - this.myString, - this.myBoolean, - }); - - @JsonKey( - nullable: false, - name: r'my_number', - required: false, - ) - num myNumber; - - @JsonKey( - nullable: false, - name: r'my_string', - required: false, - ) - String myString; - - @JsonKey( - nullable: false, - name: r'my_boolean', - required: false, - ) - bool myBoolean; - - @override - bool operator ==(Object other) => identical(this, other) || other is OuterComposite && - other.myNumber == myNumber && - other.myString == myString && - other.myBoolean == myBoolean; - - @override - int get hashCode => - (myNumber == null ? 0 : myNumber.hashCode) + - (myString == null ? 0 : myString.hashCode) + - (myBoolean == null ? 0 : myBoolean.hashCode); - - factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); - - Map toJson() => _$OuterCompositeToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart deleted file mode 100644 index a91f63c0ed2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnum { - placed, - approved, - delivered, -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart deleted file mode 100644 index a1e26235455..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumDefaultValue { - placed, - approved, - delivered, -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart deleted file mode 100644 index 5fa167be541..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumInteger { - number0, - number1, - number2, -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart deleted file mode 100644 index 5d6ed62ea7c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -enum OuterEnumIntegerDefaultValue { - number0, - number1, - number2, -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart deleted file mode 100644 index 9971d8b005d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class OuterObjectWithEnumProperty { - /// Returns a new [OuterObjectWithEnumProperty] instance. - OuterObjectWithEnumProperty({ - @required this.value, - }); - - @JsonKey( - nullable: false, - name: r'value', - required: true, - ) - OuterEnumInteger value; - - @override - bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty && - other.value == value; - - @override - int get hashCode => - (value == null ? 0 : value.hashCode); - - factory OuterObjectWithEnumProperty.fromJson(Map json) => _$OuterObjectWithEnumPropertyFromJson(json); - - Map toJson() => _$OuterObjectWithEnumPropertyToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart deleted file mode 100644 index 572f3e67f7c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart +++ /dev/null @@ -1,105 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Pet { - /// Returns a new [Pet] instance. - Pet({ - this.id, - this.category, - @required this.name, - this.photoUrls = const {}, - this.tags = const [], - this.status, - }); - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - int id; - - @JsonKey( - nullable: false, - name: r'category', - required: false, - ) - Category category; - - @JsonKey( - nullable: false, - name: r'name', - required: true, - ) - String name; - - @JsonKey( - defaultValue: const {}, - name: r'photoUrls', - required: true, - ) - Set photoUrls; - - @JsonKey( - defaultValue: const [], - name: r'tags', - required: false, - ) - List tags; - - /// pet status in the store - @JsonKey( - nullable: false, - name: r'status', - required: false, - ) - PetStatusEnum status; - - @override - bool operator ==(Object other) => identical(this, other) || other is Pet && - other.id == id && - other.category == category && - other.name == name && - other.photoUrls == photoUrls && - other.tags == tags && - other.status == status; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (category == null ? 0 : category.hashCode) + - (name == null ? 0 : name.hashCode) + - (photoUrls == null ? 0 : photoUrls.hashCode) + - (tags == null ? 0 : tags.hashCode) + - (status == null ? 0 : status.hashCode); - - factory Pet.fromJson(Map json) => _$PetFromJson(json); - - Map toJson() => _$PetToJson(this); - - @override - String toString() => toJson().toString(); -} - -/// pet status in the store -enum PetStatusEnum { - available, - pending, - sold, -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart deleted file mode 100644 index 46af402a0e5..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class ReadOnlyFirst { - /// Returns a new [ReadOnlyFirst] instance. - ReadOnlyFirst({ - this.bar, - this.baz, - }); - - @JsonKey( - nullable: false, - name: r'bar', - required: false, - ) - String bar; - - @JsonKey( - nullable: false, - name: r'baz', - required: false, - ) - String baz; - - @override - bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && - other.bar == bar && - other.baz == baz; - - @override - int get hashCode => - (bar == null ? 0 : bar.hashCode) + - (baz == null ? 0 : baz.hashCode); - - factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); - - Map toJson() => _$ReadOnlyFirstToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart deleted file mode 100644 index 34e81dbe4d9..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart +++ /dev/null @@ -1,47 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class SpecialModelName { - /// Returns a new [SpecialModelName] instance. - SpecialModelName({ - this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, - }); - - @JsonKey( - nullable: false, - name: r'$special[property.name]', - required: false, - ) - int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; - - @override - bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && - other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; - - @override - int get hashCode => - (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode); - - factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); - - Map toJson() => _$SpecialModelNameToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart deleted file mode 100644 index 797f3fdcded..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart +++ /dev/null @@ -1,57 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class Tag { - /// Returns a new [Tag] instance. - Tag({ - this.id, - this.name, - }); - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - int id; - - @JsonKey( - nullable: false, - name: r'name', - required: false, - ) - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Tag && - other.id == id && - other.name == name; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); - - factory Tag.fromJson(Map json) => _$TagFromJson(json); - - Map toJson() => _$TagToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart deleted file mode 100644 index 8ca6ebef695..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart +++ /dev/null @@ -1,118 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: constant_identifier_names -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: true, - explicitToJson: true, -) -class User { - /// Returns a new [User] instance. - User({ - this.id, - this.username, - this.firstName, - this.lastName, - this.email, - this.password, - this.phone, - this.userStatus, - }); - - @JsonKey( - nullable: false, - name: r'id', - required: false, - ) - int id; - - @JsonKey( - nullable: false, - name: r'username', - required: false, - ) - String username; - - @JsonKey( - nullable: false, - name: r'firstName', - required: false, - ) - String firstName; - - @JsonKey( - nullable: false, - name: r'lastName', - required: false, - ) - String lastName; - - @JsonKey( - nullable: false, - name: r'email', - required: false, - ) - String email; - - @JsonKey( - nullable: false, - name: r'password', - required: false, - ) - String password; - - @JsonKey( - nullable: false, - name: r'phone', - required: false, - ) - String phone; - - /// User Status - @JsonKey( - nullable: false, - name: r'userStatus', - required: false, - ) - int userStatus; - - @override - bool operator ==(Object other) => identical(this, other) || other is User && - other.id == id && - other.username == username && - other.firstName == firstName && - other.lastName == lastName && - other.email == email && - other.password == password && - other.phone == phone && - other.userStatus == userStatus; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (username == null ? 0 : username.hashCode) + - (firstName == null ? 0 : firstName.hashCode) + - (lastName == null ? 0 : lastName.hashCode) + - (email == null ? 0 : email.hashCode) + - (password == null ? 0 : password.hashCode) + - (phone == null ? 0 : phone.hashCode) + - (userStatus == null ? 0 : userStatus.hashCode); - - factory User.fromJson(Map json) => _$UserFromJson(json); - - Map toJson() => _$UserToJson(this); - - @override - String toString() => toJson().toString(); -} - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml deleted file mode 100644 index 708ad415515..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientJsonSerializableLibTests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client with json_serializable Lib - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml deleted file mode 100644 index 66b0d5a7acd..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# - -name: 'openapi' -version: '1.0.0' -description: 'OpenAPI API client' -homepage: 'homepage' -environment: - sdk: '>=2.12.0 <3.0.0' -dependencies: - http: '>=0.13.0 <0.14.0' - intl: '^0.17.0' - meta: '^1.1.8' - json_annotation: '^3.1.1' -dev_dependencies: - test: '>=1.16.0 <1.18.0' - build_runner: '^1.10.9' - json_serializable: '^3.5.1' diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart deleted file mode 100644 index 3f231dddf74..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for AdditionalPropertiesClass -void main() { - final instance = AdditionalPropertiesClass(); - - group('test AdditionalPropertiesClass', () { - // Map mapProperty (default value: const {}) - test('to test the property `mapProperty`', () async { - // TODO - }); - - // Map> mapOfMapProperty (default value: const {}) - test('to test the property `mapOfMapProperty`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart deleted file mode 100644 index 3e6526e7195..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Animal -void main() { - final instance = Animal(); - - group('test Animal', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart deleted file mode 100644 index 355b4140bdd..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for AnotherFakeApi -void main() { - final instance = AnotherFakeApi(); - - group('tests for AnotherFakeApi', () { - // To test special tags - // - // To test special tags and operation ID starting with number - // - //Future call123testSpecialTags(ModelClient modelClient) async - test('test call123testSpecialTags', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart deleted file mode 100644 index b0c30615b92..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ApiResponse -void main() { - final instance = ApiResponse(); - - group('test ApiResponse', () { - // int code - test('to test the property `code`', () async { - // TODO - }); - - // String type - test('to test the property `type`', () async { - // TODO - }); - - // String message - test('to test the property `message`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart deleted file mode 100644 index 53ed7123a88..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfArrayOfNumberOnly -void main() { - final instance = ArrayOfArrayOfNumberOnly(); - - group('test ArrayOfArrayOfNumberOnly', () { - // List> arrayArrayNumber (default value: const []) - test('to test the property `arrayArrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart deleted file mode 100644 index 99fb4e3ddf7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayOfNumberOnly -void main() { - final instance = ArrayOfNumberOnly(); - - group('test ArrayOfNumberOnly', () { - // List arrayNumber (default value: const []) - test('to test the property `arrayNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart deleted file mode 100644 index f1af158fe2f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ArrayTest -void main() { - final instance = ArrayTest(); - - group('test ArrayTest', () { - // List arrayOfString (default value: const []) - test('to test the property `arrayOfString`', () async { - // TODO - }); - - // List> arrayArrayOfInteger (default value: const []) - test('to test the property `arrayArrayOfInteger`', () async { - // TODO - }); - - // List> arrayArrayOfModel (default value: const []) - test('to test the property `arrayArrayOfModel`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart deleted file mode 100644 index c21e1a31c93..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Capitalization -void main() { - final instance = Capitalization(); - - group('test Capitalization', () { - // String smallCamel - test('to test the property `smallCamel`', () async { - // TODO - }); - - // String capitalCamel - test('to test the property `capitalCamel`', () async { - // TODO - }); - - // String smallSnake - test('to test the property `smallSnake`', () async { - // TODO - }); - - // String capitalSnake - test('to test the property `capitalSnake`', () async { - // TODO - }); - - // String sCAETHFlowPoints - test('to test the property `sCAETHFlowPoints`', () async { - // TODO - }); - - // Name of the pet - // String ATT_NAME - test('to test the property `ATT_NAME`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart deleted file mode 100644 index f4d0a69b7ca..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for CatAllOf -void main() { - final instance = CatAllOf(); - - group('test CatAllOf', () { - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart deleted file mode 100644 index e7d33048bbc..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Cat -void main() { - final instance = Cat(); - - group('test Cat', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // bool declawed - test('to test the property `declawed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart deleted file mode 100644 index 54d51663d9d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Category -void main() { - final instance = Category(); - - group('test Category', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name (default value: 'default-name') - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart deleted file mode 100644 index 047ce788765..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ClassModel -void main() { - final instance = ClassModel(); - - group('test ClassModel', () { - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart deleted file mode 100644 index 2756c463df1..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for DefaultApi -void main() { - final instance = DefaultApi(); - - group('tests for DefaultApi', () { - //Future fooGet() async - test('test fooGet', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart deleted file mode 100644 index a1c6df25058..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/deprecated_object_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DeprecatedObject -void main() { - final instance = DeprecatedObject(); - - group('test DeprecatedObject', () { - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart deleted file mode 100644 index 5a0209898b8..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for DogAllOf -void main() { - final instance = DogAllOf(); - - group('test DogAllOf', () { - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart deleted file mode 100644 index bce7e5bbdec..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Dog -void main() { - final instance = Dog(); - - group('test Dog', () { - // String className - test('to test the property `className`', () async { - // TODO - }); - - // String color (default value: 'red') - test('to test the property `color`', () async { - // TODO - }); - - // String breed - test('to test the property `breed`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart deleted file mode 100644 index b3364c9a89a..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumArrays -void main() { - final instance = EnumArrays(); - - group('test EnumArrays', () { - // String justSymbol - test('to test the property `justSymbol`', () async { - // TODO - }); - - // List arrayEnum (default value: const []) - test('to test the property `arrayEnum`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart deleted file mode 100644 index 496ffbd68cf..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumClass -void main() { - - group('test EnumClass', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart deleted file mode 100644 index 52618838aff..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart +++ /dev/null @@ -1,61 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for EnumTest -void main() { - final instance = EnumTest(); - - group('test EnumTest', () { - // String enumString - test('to test the property `enumString`', () async { - // TODO - }); - - // String enumStringRequired - test('to test the property `enumStringRequired`', () async { - // TODO - }); - - // int enumInteger - test('to test the property `enumInteger`', () async { - // TODO - }); - - // double enumNumber - test('to test the property `enumNumber`', () async { - // TODO - }); - - // OuterEnum outerEnum - test('to test the property `outerEnum`', () async { - // TODO - }); - - // OuterEnumInteger outerEnumInteger - test('to test the property `outerEnumInteger`', () async { - // TODO - }); - - // OuterEnumDefaultValue outerEnumDefaultValue - test('to test the property `outerEnumDefaultValue`', () async { - // TODO - }); - - // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue - test('to test the property `outerEnumIntegerDefaultValue`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart deleted file mode 100644 index 065e89afdc1..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart +++ /dev/null @@ -1,138 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeApi -void main() { - final instance = FakeApi(); - - group('tests for FakeApi', () { - // Health check endpoint - // - //Future fakeHealthGet() async - test('test fakeHealthGet', () async { - // TODO - }); - - // test http signature authentication - // - //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async - test('test fakeHttpSignatureTest', () async { - // TODO - }); - - // Test serialization of outer boolean types - // - //Future fakeOuterBooleanSerialize({ bool body }) async - test('test fakeOuterBooleanSerialize', () async { - // TODO - }); - - // Test serialization of object with outer number type - // - //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async - test('test fakeOuterCompositeSerialize', () async { - // TODO - }); - - // Test serialization of outer number types - // - //Future fakeOuterNumberSerialize({ num body }) async - test('test fakeOuterNumberSerialize', () async { - // TODO - }); - - // Test serialization of outer string types - // - //Future fakeOuterStringSerialize({ String body }) async - test('test fakeOuterStringSerialize', () async { - // TODO - }); - - // Test serialization of enum (int) properties with examples - // - //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async - test('test fakePropertyEnumIntegerSerialize', () async { - // TODO - }); - - // For this test, the body for this request much reference a schema named `File`. - // - //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async - test('test testBodyWithFileSchema', () async { - // TODO - }); - - //Future testBodyWithQueryParams(String query, User user) async - test('test testBodyWithQueryParams', () async { - // TODO - }); - - // To test \"client\" model - // - // To test \"client\" model - // - //Future testClientModel(ModelClient modelClient) async - test('test testClientModel', () async { - // TODO - }); - - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - // - //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async - test('test testEndpointParameters', () async { - // TODO - }); - - // To test enum parameters - // - // To test enum parameters - // - //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async - test('test testEnumParameters', () async { - // TODO - }); - - // Fake endpoint to test group parameters (optional) - // - // Fake endpoint to test group parameters (optional) - // - //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async - test('test testGroupParameters', () async { - // TODO - }); - - // test inline additionalProperties - // - //Future testInlineAdditionalProperties(Map requestBody) async - test('test testInlineAdditionalProperties', () async { - // TODO - }); - - // test json serialization of form data - // - //Future testJsonFormData(String param, String param2) async - test('test testJsonFormData', () async { - // TODO - }); - - // To test the collection format in query parameters - // - //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async - test('test testQueryParameterCollectionFormat', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart deleted file mode 100644 index 1a0f9658947..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for FakeClassnameTags123Api -void main() { - final instance = FakeClassnameTags123Api(); - - group('tests for FakeClassnameTags123Api', () { - // To test class name in snake case - // - // To test class name in snake case - // - //Future testClassname(ModelClient modelClient) async - test('test testClassname', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart deleted file mode 100644 index 4316bb385a7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FileSchemaTestClass -void main() { - final instance = FileSchemaTestClass(); - - group('test FileSchemaTestClass', () { - // ModelFile file - test('to test the property `file`', () async { - // TODO - }); - - // List files (default value: const []) - test('to test the property `files`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart deleted file mode 100644 index 7b72da51b0e..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Foo -void main() { - final instance = Foo(); - - group('test Foo', () { - // String bar (default value: 'bar') - test('to test the property `bar`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart deleted file mode 100644 index e776be1d9f6..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart +++ /dev/null @@ -1,103 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for FormatTest -void main() { - final instance = FormatTest(); - - group('test FormatTest', () { - // int integer - test('to test the property `integer`', () async { - // TODO - }); - - // int int32 - test('to test the property `int32`', () async { - // TODO - }); - - // int int64 - test('to test the property `int64`', () async { - // TODO - }); - - // num number - test('to test the property `number`', () async { - // TODO - }); - - // double float - test('to test the property `float`', () async { - // TODO - }); - - // double double_ - test('to test the property `double_`', () async { - // TODO - }); - - // double decimal - test('to test the property `decimal`', () async { - // TODO - }); - - // String string - test('to test the property `string`', () async { - // TODO - }); - - // String byte - test('to test the property `byte`', () async { - // TODO - }); - - // MultipartFile binary - test('to test the property `binary`', () async { - // TODO - }); - - // DateTime date - test('to test the property `date`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // A string that is a 10 digit number. Can have leading zeros. - // String patternWithDigits - test('to test the property `patternWithDigits`', () async { - // TODO - }); - - // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - // String patternWithDigitsAndDelimiter - test('to test the property `patternWithDigitsAndDelimiter`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart deleted file mode 100644 index 16b36e11709..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HasOnlyReadOnly -void main() { - final instance = HasOnlyReadOnly(); - - group('test HasOnlyReadOnly', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String foo - test('to test the property `foo`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart deleted file mode 100644 index 1599fc46a28..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for HealthCheckResult -void main() { - final instance = HealthCheckResult(); - - group('test HealthCheckResult', () { - // String nullableMessage - test('to test the property `nullableMessage`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart deleted file mode 100644 index ecb2a874f05..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for InlineResponseDefault -void main() { - final instance = InlineResponseDefault(); - - group('test InlineResponseDefault', () { - // Foo string - test('to test the property `string`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart deleted file mode 100644 index 21af0b85fa3..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MapTest -void main() { - final instance = MapTest(); - - group('test MapTest', () { - // Map> mapMapOfString (default value: const {}) - test('to test the property `mapMapOfString`', () async { - // TODO - }); - - // Map mapOfEnumString (default value: const {}) - test('to test the property `mapOfEnumString`', () async { - // TODO - }); - - // Map directMap (default value: const {}) - test('to test the property `directMap`', () async { - // TODO - }); - - // Map indirectMap (default value: const {}) - test('to test the property `indirectMap`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart deleted file mode 100644 index a8e0fdd8da6..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for MixedPropertiesAndAdditionalPropertiesClass -void main() { - final instance = MixedPropertiesAndAdditionalPropertiesClass(); - - group('test MixedPropertiesAndAdditionalPropertiesClass', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // DateTime dateTime - test('to test the property `dateTime`', () async { - // TODO - }); - - // Map map (default value: const {}) - test('to test the property `map`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart deleted file mode 100644 index c28d3671dfc..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Model200Response -void main() { - final instance = Model200Response(); - - group('test Model200Response', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // String class_ - test('to test the property `class_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart deleted file mode 100644 index c0a59729e3d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelClient -void main() { - final instance = ModelClient(); - - group('test ModelClient', () { - // String client - test('to test the property `client`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart deleted file mode 100644 index b2f6d48afa7..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelFile -void main() { - final instance = ModelFile(); - - group('test ModelFile', () { - // Test capitalization - // String sourceURI - test('to test the property `sourceURI`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart deleted file mode 100644 index 02e98011b21..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelList -void main() { - final instance = ModelList(); - - group('test ModelList', () { - // String n123list - test('to test the property `n123list`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart deleted file mode 100644 index b7f065e4fb4..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ModelReturn -void main() { - final instance = ModelReturn(); - - group('test ModelReturn', () { - // int return_ - test('to test the property `return_`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart deleted file mode 100644 index 8e0ef41e9f2..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Name -void main() { - final instance = Name(); - - group('test Name', () { - // int name - test('to test the property `name`', () async { - // TODO - }); - - // int snakeCase - test('to test the property `snakeCase`', () async { - // TODO - }); - - // String property - test('to test the property `property`', () async { - // TODO - }); - - // int n123number - test('to test the property `n123number`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart deleted file mode 100644 index 6147fbe1336..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NullableClass -void main() { - final instance = NullableClass(); - - group('test NullableClass', () { - // int integerProp - test('to test the property `integerProp`', () async { - // TODO - }); - - // num numberProp - test('to test the property `numberProp`', () async { - // TODO - }); - - // bool booleanProp - test('to test the property `booleanProp`', () async { - // TODO - }); - - // String stringProp - test('to test the property `stringProp`', () async { - // TODO - }); - - // DateTime dateProp - test('to test the property `dateProp`', () async { - // TODO - }); - - // DateTime datetimeProp - test('to test the property `datetimeProp`', () async { - // TODO - }); - - // List arrayNullableProp (default value: const []) - test('to test the property `arrayNullableProp`', () async { - // TODO - }); - - // List arrayAndItemsNullableProp (default value: const []) - test('to test the property `arrayAndItemsNullableProp`', () async { - // TODO - }); - - // List arrayItemsNullable (default value: const []) - test('to test the property `arrayItemsNullable`', () async { - // TODO - }); - - // Map objectNullableProp (default value: const {}) - test('to test the property `objectNullableProp`', () async { - // TODO - }); - - // Map objectAndItemsNullableProp (default value: const {}) - test('to test the property `objectAndItemsNullableProp`', () async { - // TODO - }); - - // Map objectItemsNullable (default value: const {}) - test('to test the property `objectItemsNullable`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart deleted file mode 100644 index 3662bff150d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for NumberOnly -void main() { - final instance = NumberOnly(); - - group('test NumberOnly', () { - // num justNumber - test('to test the property `justNumber`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart deleted file mode 100644 index b5769dc6749..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/object_with_deprecated_fields_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ObjectWithDeprecatedFields -void main() { - final instance = ObjectWithDeprecatedFields(); - - group('test ObjectWithDeprecatedFields', () { - // String uuid - test('to test the property `uuid`', () async { - // TODO - }); - - // num id - test('to test the property `id`', () async { - // TODO - }); - - // DeprecatedObject deprecatedRef - test('to test the property `deprecatedRef`', () async { - // TODO - }); - - // List bars (default value: const []) - test('to test the property `bars`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart deleted file mode 100644 index 614a14e42bb..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Order -void main() { - final instance = Order(); - - group('test Order', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // int petId - test('to test the property `petId`', () async { - // TODO - }); - - // int quantity - test('to test the property `quantity`', () async { - // TODO - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart deleted file mode 100644 index 294c823443c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterComposite -void main() { - final instance = OuterComposite(); - - group('test OuterComposite', () { - // num myNumber - test('to test the property `myNumber`', () async { - // TODO - }); - - // String myString - test('to test the property `myString`', () async { - // TODO - }); - - // bool myBoolean - test('to test the property `myBoolean`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart deleted file mode 100644 index 84ae975ef18..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumDefaultValue -void main() { - - group('test OuterEnumDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart deleted file mode 100644 index bf3399ba428..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumIntegerDefaultValue -void main() { - - group('test OuterEnumIntegerDefaultValue', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart deleted file mode 100644 index d807f03227f..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnumInteger -void main() { - - group('test OuterEnumInteger', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart deleted file mode 100644 index a2b79ce0c1c..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterEnum -void main() { - - group('test OuterEnum', () { - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart deleted file mode 100644 index 6995c37ebb4..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for OuterObjectWithEnumProperty -void main() { - final instance = OuterObjectWithEnumProperty(); - - group('test OuterObjectWithEnumProperty', () { - // OuterEnumInteger value - test('to test the property `value`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart deleted file mode 100644 index 5f4c994acef..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = PetApi(); - - group('tests for PetApi', () { - // Add a new pet to the store - // - //Future addPet(Pet pet) async - test('test addPet', () async { - // TODO - }); - - // Deletes a pet - // - //Future deletePet(int petId, { String apiKey }) async - test('test deletePet', () async { - // TODO - }); - - // Finds Pets by status - // - // Multiple status values can be provided with comma separated strings - // - //Future> findPetsByStatus(List status) async - test('test findPetsByStatus', () async { - // TODO - }); - - // Finds Pets by tags - // - // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - // - //Future> findPetsByTags(Set tags) async - test('test findPetsByTags', () async { - // TODO - }); - - // Find pet by ID - // - // Returns a single pet - // - //Future getPetById(int petId) async - test('test getPetById', () async { - // TODO - }); - - // Update an existing pet - // - //Future updatePet(Pet pet) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async - test('test uploadFile', () async { - // TODO - }); - - // uploads an image (required) - // - //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async - test('test uploadFileWithRequiredFile', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart deleted file mode 100644 index 23c26595c85..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Pet -void main() { - final instance = Pet(); - - group('test Pet', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // Category category - test('to test the property `category`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - // Set photoUrls (default value: const {}) - test('to test the property `photoUrls`', () async { - // TODO - }); - - // List tags (default value: const []) - test('to test the property `tags`', () async { - // TODO - }); - - // pet status in the store - // String status - test('to test the property `status`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart deleted file mode 100644 index d3326fd494d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ReadOnlyFirst -void main() { - final instance = ReadOnlyFirst(); - - group('test ReadOnlyFirst', () { - // String bar - test('to test the property `bar`', () async { - // TODO - }); - - // String baz - test('to test the property `baz`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart deleted file mode 100644 index f3b461364fb..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for SpecialModelName -void main() { - final instance = SpecialModelName(); - - group('test SpecialModelName', () { - // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket - test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart deleted file mode 100644 index 4a7ed54abbb..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = StoreApi(); - - group('tests for StoreApi', () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order order) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart deleted file mode 100644 index 66ecdfe488d..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Tag -void main() { - final instance = Tag(); - - group('test Tag', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart deleted file mode 100644 index 73ee89a2945..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = UserApi(); - - group('tests for UserApi', () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User user) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(List user) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(List user) async - test('test createUsersWithListInput', () async { - // TODO - }); - - // Delete user - // - // This can only be done by the logged in user. - // - //Future deleteUser(String username) async - test('test deleteUser', () async { - // TODO - }); - - // Get user by user name - // - //Future getUserByName(String username) async - test('test getUserByName', () async { - // TODO - }); - - // Logs user into the system - // - //Future loginUser(String username, String password) async - test('test loginUser', () async { - // TODO - }); - - // Logs out current logged in user session - // - //Future logoutUser() async - test('test logoutUser', () async { - // TODO - }); - - // Updated user - // - // This can only be done by the logged in user. - // - //Future updateUser(String username, User user) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart deleted file mode 100644 index b89cd360489..00000000000 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for User -void main() { - final instance = User(); - - group('test User', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String username - test('to test the property `username`', () async { - // TODO - }); - - // String firstName - test('to test the property `firstName`', () async { - // TODO - }); - - // String lastName - test('to test the property `lastName`', () async { - // TODO - }); - - // String email - test('to test the property `email`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // String phone - test('to test the property `phone`', () async { - // TODO - }); - - // User Status - // int userStatus - test('to test the property `userStatus`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/README.md b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/README.md index d7b835f508a..d58ea10bdc0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/README.md @@ -14,7 +14,7 @@ test Building the API client library requires: 1. Java 1.8+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-openapi3-jersey2-java8-special-characters:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-openapi3-jersey2-java8-special-characters' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-openapi3-jersey2-java8-special-characters' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-openapi3-jersey2-java8-special-characters:1.0.0" + } ``` ### Others diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle index b8563fe54bf..5a1312b5f80 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -77,13 +75,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-openapi3-jersey2-java8-special-characters' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-openapi3-jersey2-java8-special-characters' + + from components.java + } } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle.properties b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle.properties index 05644f0754a..a3408578278 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle.properties +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle.properties @@ -1,2 +1,6 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.jar and b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.properties +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew.bat b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew.bat +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 0c9137a14d9..4e49a39330a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -14,7 +14,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.8+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -50,7 +50,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-openapi3-jersey2-java8:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-openapi3-jersey2-java8' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-openapi3-jersey2-java8' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-openapi3-jersey2-java8:1.0.0" + } ``` ### Others diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle index 88a93f54b5e..2a964a5d092 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,10 +15,9 @@ buildscript { } repositories { - jcenter() + mavenCentral() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -77,13 +75,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-openapi3-jersey2-java8' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-openapi3-jersey2-java8' + + from components.java + } } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties b/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties index 05644f0754a..d3e8e41ba6f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties @@ -1,2 +1,13 @@ -# Uncomment to build for Android -#target = android \ No newline at end of file +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android + +# JVM arguments +org.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m +# set timeout +org.gradle.daemon.idletimeout=3600000 +# show all warnings +org.gradle.warning.mode=all diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar and b/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew index 4f906e0c811..005bcde0428 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat index 107acd32c4e..6a68175eb70 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/schema/petstore/ktorm/docs/Order.md b/samples/schema/petstore/ktorm/docs/Order.md index 543c4002474..102962a706f 100644 --- a/samples/schema/petstore/ktorm/docs/Order.md +++ b/samples/schema/petstore/ktorm/docs/Order.md @@ -9,7 +9,7 @@ Name | Mapping | SQL Type | Default | Type | Description | Notes **petId** | petId | long | | **kotlin.Long** | | [optional] **quantity** | quantity | int | | **kotlin.Int** | | [optional] **shipDate** | shipDate | datetime | | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional] -**status** | status | text | | [**status**](#StatusEnum) | Order Status | [optional] +**status** | status | text | | [**status**](#Status) | Order Status | [optional] **complete** | complete | boolean | | **kotlin.Boolean** | | [optional] diff --git a/samples/schema/petstore/ktorm/docs/Pet.md b/samples/schema/petstore/ktorm/docs/Pet.md index 28a16b88cc8..646fe4d1723 100644 --- a/samples/schema/petstore/ktorm/docs/Pet.md +++ b/samples/schema/petstore/ktorm/docs/Pet.md @@ -10,7 +10,7 @@ Name | Mapping | SQL Type | Default | Type | Description | Notes **id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional] **category** | category | long | | [**Category**](Category.md) | | [optional] [foreignkey] **tags** | `One-To-Many` | `----` | `----` | [**kotlin.Array<Tag>**](Tag.md) | | [optional] -**status** | status | text | | [**status**](#StatusEnum) | pet status in the store | [optional] +**status** | status | text | | [**status**](#Status) | pet status in the store | [optional] diff --git a/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION b/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION index d99e7162d01..717311e32e3 100644 --- a/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/server/petstore/cpp-restbed/api/PetApi.cpp b/samples/server/petstore/cpp-restbed/api/PetApi.cpp index 1700f2fd44b..65b08975bea 100644 --- a/samples/server/petstore/cpp-restbed/api/PetApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/PetApi.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "PetApi.h" @@ -25,51 +30,71 @@ namespace api { using namespace org::openapitools::server::model; -PetApi::PetApi() { -} - -PetApi::~PetApi() {} - -void PetApi::startService(int const& port) { - // A typical pattern is to derive a class from PetApi and allocate the shared pointers for restbed::Resource objects - // and manipulate them (e.g. binding GET/POST handler functions) before this startService() gets called. - // In such a case we want to use our m_spXXX variables. - // However in case these shared pointers are nullptr, then allocate the restbed::Resources now: - if (!m_spPetApiPetResource) - m_spPetApiPetResource = std::make_shared(); - this->publish(m_spPetApiPetResource); - if (!m_spPetApiPetPetIdResource) - m_spPetApiPetPetIdResource = std::make_shared(); - this->publish(m_spPetApiPetPetIdResource); - if (!m_spPetApiPetFindByStatusResource) - m_spPetApiPetFindByStatusResource = std::make_shared(); - this->publish(m_spPetApiPetFindByStatusResource); - if (!m_spPetApiPetFindByTagsResource) - m_spPetApiPetFindByTagsResource = std::make_shared(); - this->publish(m_spPetApiPetFindByTagsResource); - if (!m_spPetApiPetPetIdUploadImageResource) - m_spPetApiPetPetIdUploadImageResource = std::make_shared(); - this->publish(m_spPetApiPetPetIdUploadImageResource); - - std::shared_ptr settings = std::make_shared(); - settings->set_port(port); - settings->set_root("/v2"); - - this->start(settings); -} - -void PetApi::stopService() { - this->stop(); -} - -PetApiPetResource::PetApiPetResource() +PetApiException::PetApiException(int status_code, std::string what) + : m_status(status_code), + m_what(what) { - this->set_path("/pet/"); + +} +int PetApiException::getStatus() const +{ + return m_status; +} +const char* PetApiException::what() const noexcept +{ + return m_what.c_str(); +} + + +template +std::shared_ptr extractJsonModelBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto model = std::make_shared(pt); + return model; +} + +template +std::vector> extractJsonArrayBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto arrayRet = std::vector>(); + for (const auto& child: pt) { + arrayRet.emplace_back(std::make_shared(child.second)); + } + return arrayRet; +} + +template +std::string convertMapResponse(const std::map& map) +{ + boost::property_tree::ptree pt; + for(const auto &kv: map) { + pt.push_back(boost::property_tree::ptree::value_type( + boost::lexical_cast(kv.first), + boost::property_tree::ptree( + boost::lexical_cast(kv.second)))); + } + std::stringstream sstream; + write_json(sstream, pt); + std::string result = sstream.str(); + return result; +} + +PetApiPetResource::PetApiPetResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/"); this->set_method_handler("POST", - std::bind(&PetApiPetResource::POST_method_handler, this, + std::bind(&PetApiPetResource::handler_POST_internal, this, std::placeholders::_1)); this->set_method_handler("PUT", - std::bind(&PetApiPetResource::PUT_method_handler, this, + std::bind(&PetApiPetResource::handler_PUT_internal, this, std::placeholders::_1)); } @@ -77,108 +102,156 @@ PetApiPetResource::~PetApiPetResource() { } -void PetApiPetResource::set_handler_POST( - std::function( - std::shared_ptr const & - )> handler) { - handler_POST_ = std::move(handler); -} - -void PetApiPetResource::set_handler_PUT( - std::function( - std::shared_ptr const & - )> handler) { - handler_PUT_ = std::move(handler); -} - -void PetApiPetResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - body - ); - } - - if (status_code == 405) { - session->close(405, result.empty() ? "Invalid input" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - -void PetApiPetResource::PUT_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_PUT_) - { - std::tie(status_code, result) = handler_PUT_( - body - ); - } - - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid ID supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 404) { - session->close(404, result.empty() ? "Pet not found" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 405) { - session->close(405, result.empty() ? "Validation exception" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - - -PetApiPetPetIdResource::PetApiPetPetIdResource() +std::pair PetApiPetResource::handlePetApiException(const PetApiException& e) { - this->set_path("/pet/{petId: .*}/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetApiPetResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetApiPetResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetApiPetResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetApiPetResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void PetApiPetResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetApiPetResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + auto body = extractJsonModelBodyParam(bodyContent); + + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(body); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 405) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 405, result.empty() ? "Invalid input" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +// x-extension +void PetApiPetResource::handler_PUT_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // body params or form params here from the body content string + auto body = extractJsonModelBodyParam(bodyContent); + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_PUT(body); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid ID supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "Pet not found" : result, contentType); + return; + } + if (status_code == 405) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 405, result.empty() ? "Validation exception" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +int PetApiPetResource::handler_POST( + std::shared_ptr const & body) +{ + throw PetApiException(501, "Not implemented"); +} + +int PetApiPetResource::handler_PUT( + std::shared_ptr const & body) +{ + throw PetApiException(501, "Not implemented"); +} + +std::string PetApiPetResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +PetApiPetPetIdResource::PetApiPetPetIdResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/{petId: .*}/"); this->set_method_handler("DELETE", - std::bind(&PetApiPetPetIdResource::DELETE_method_handler, this, + std::bind(&PetApiPetPetIdResource::handler_DELETE_internal, this, + std::placeholders::_1)); + this->set_method_handler("GET", + std::bind(&PetApiPetPetIdResource::handler_GET_internal, this, std::placeholders::_1)); this->set_method_handler("POST", - std::bind(&PetApiPetPetIdResource::POST_method_handler, this, + std::bind(&PetApiPetPetIdResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -186,82 +259,190 @@ PetApiPetPetIdResource::~PetApiPetPetIdResource() { } -void PetApiPetPetIdResource::set_handler_DELETE( - std::function( - int64_t const &, std::string const & - )> handler) { - handler_DELETE_ = std::move(handler); -} - -void PetApiPetPetIdResource::set_handler_POST( - std::function( - int64_t const &, std::string const &, std::string const & - )> handler) { - handler_POST_ = std::move(handler); -} - -void PetApiPetPetIdResource::DELETE_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const int64_t petId = request->get_path_parameter("petId", 0L); - - - // Getting the headers - const std::string apiKey = request->get_header("apiKey", ""); - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_DELETE_) - { - std::tie(status_code, result) = handler_DELETE_( - petId, apiKey - ); - } - - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid pet value" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - -void PetApiPetPetIdResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const int64_t petId = request->get_path_parameter("petId", 0L); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - petId, name, status - ); - } - - if (status_code == 405) { - session->close(405, result.empty() ? "Invalid input" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - -PetApiPetFindByStatusResource::PetApiPetFindByStatusResource() +std::pair PetApiPetPetIdResource::handlePetApiException(const PetApiException& e) { - this->set_path("/pet/findByStatus/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetApiPetPetIdResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetApiPetPetIdResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetApiPetPetIdResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetApiPetPetIdResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void PetApiPetPetIdResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetApiPetPetIdResource::handler_DELETE_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + // Getting the path params + const int64_t petId = getPathParam_petId(request); + + + // Getting the headers + const std::string apiKey = getHeader_api_key(request); + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_DELETE(petId, apiKey); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid pet value" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +// x-extension +void PetApiPetPetIdResource::handler_GET_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + + // Getting the path params + const int64_t petId = getPathParam_petId_x_extension(request); + + + int status_code = 500; + std::shared_ptr resultObject = std::make_shared(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(petId); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject->toJsonString(); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid ID supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "Pet not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} +// x-extension +void PetApiPetPetIdResource::handler_POST_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + + // Getting the path params + const int64_t petId = getPathParam_petId_x_extension(request); + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(petId, name, status); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 405) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 405, result.empty() ? "Invalid input" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +int PetApiPetPetIdResource::handler_DELETE( + int64_t const & petId, std::string const & apiKey) +{ + throw PetApiException(501, "Not implemented"); +} + +std::pair> PetApiPetPetIdResource::handler_GET( + int64_t const & petId) +{ + throw PetApiException(501, "Not implemented"); +} +int PetApiPetPetIdResource::handler_POST( + int64_t const & petId, std::string const & name, std::string const & status) +{ + throw PetApiException(501, "Not implemented"); +} + +std::string PetApiPetPetIdResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +PetApiPetFindByStatusResource::PetApiPetFindByStatusResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/findByStatus/"); this->set_method_handler("GET", - std::bind(&PetApiPetFindByStatusResource::GET_method_handler, this, + std::bind(&PetApiPetFindByStatusResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -269,51 +450,102 @@ PetApiPetFindByStatusResource::~PetApiPetFindByStatusResource() { } -void PetApiPetFindByStatusResource::set_handler_GET( - std::function( - std::vector const & - )> handler) { - handler_GET_ = std::move(handler); -} - - -void PetApiPetFindByStatusResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - - // Getting the query params - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - status - ); - } - - if (status_code == 200) { - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid status value" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - - -PetApiPetFindByTagsResource::PetApiPetFindByTagsResource() +std::pair PetApiPetFindByStatusResource::handlePetApiException(const PetApiException& e) { - this->set_path("/pet/findByTags/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetApiPetFindByStatusResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetApiPetFindByStatusResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetApiPetFindByStatusResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetApiPetFindByStatusResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void PetApiPetFindByStatusResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetApiPetFindByStatusResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + + // Getting the query params + + + int status_code = 500; + std::vector> resultObject = std::vector>(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(status); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid status value" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +std::pair>> PetApiPetFindByStatusResource::handler_GET( + std::vector const & status) +{ + throw PetApiException(501, "Not implemented"); +} + + +std::string PetApiPetFindByStatusResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +PetApiPetFindByTagsResource::PetApiPetFindByTagsResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/findByTags/"); this->set_method_handler("GET", - std::bind(&PetApiPetFindByTagsResource::GET_method_handler, this, + std::bind(&PetApiPetFindByTagsResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -321,51 +553,102 @@ PetApiPetFindByTagsResource::~PetApiPetFindByTagsResource() { } -void PetApiPetFindByTagsResource::set_handler_GET( - std::function( - std::vector const & - )> handler) { - handler_GET_ = std::move(handler); -} - - -void PetApiPetFindByTagsResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - - // Getting the query params - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - tags - ); - } - - if (status_code == 200) { - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid tag value" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - - -PetApiPetPetIdUploadImageResource::PetApiPetPetIdUploadImageResource() +std::pair PetApiPetFindByTagsResource::handlePetApiException(const PetApiException& e) { - this->set_path("/pet/{petId: .*}/uploadImage/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetApiPetFindByTagsResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetApiPetFindByTagsResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetApiPetFindByTagsResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetApiPetFindByTagsResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void PetApiPetFindByTagsResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetApiPetFindByTagsResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + + // Getting the query params + + + int status_code = 500; + std::vector> resultObject = std::vector>(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(tags); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid tag value" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +std::pair>> PetApiPetFindByTagsResource::handler_GET( + std::vector const & tags) +{ + throw PetApiException(501, "Not implemented"); +} + + +std::string PetApiPetFindByTagsResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +PetApiPetPetIdUploadImageResource::PetApiPetPetIdUploadImageResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/{petId: .*}/uploadImage/"); this->set_method_handler("POST", - std::bind(&PetApiPetPetIdUploadImageResource::POST_method_handler, this, + std::bind(&PetApiPetPetIdUploadImageResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -373,42 +656,144 @@ PetApiPetPetIdUploadImageResource::~PetApiPetPetIdUploadImageResource() { } -void PetApiPetPetIdUploadImageResource::set_handler_POST( - std::function( - int64_t const &, std::string const &, std::string const & - )> handler) { - handler_POST_ = std::move(handler); +std::pair PetApiPetPetIdUploadImageResource::handlePetApiException(const PetApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetApiPetPetIdUploadImageResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetApiPetPetIdUploadImageResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetApiPetPetIdUploadImageResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetApiPetPetIdUploadImageResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void PetApiPetPetIdUploadImageResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetApiPetPetIdUploadImageResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + // Getting the path params + const int64_t petId = getPathParam_petId(request); + + + + int status_code = 500; + std::shared_ptr resultObject = std::make_shared(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_POST(petId, additionalMetadata, file); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject->toJsonString(); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); } -void PetApiPetPetIdUploadImageResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const int64_t petId = request->get_path_parameter("petId", 0L); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - petId, additionalMetadata, file - ); - } - - if (status_code == 200) { - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - +std::pair> PetApiPetPetIdUploadImageResource::handler_POST( + int64_t const & petId, std::string const & additionalMetadata, std::string const & file) +{ + throw PetApiException(501, "Not implemented"); } +std::string PetApiPetPetIdUploadImageResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +PetApi::PetApi(std::shared_ptr const& restbedService) +: m_service(restbedService) +{ +} + +PetApi::~PetApi() {} + +void PetApi::setPetApiPetResource(std::shared_ptr spPetApiPetResource) { + m_spPetApiPetResource = spPetApiPetResource; + m_service->publish(m_spPetApiPetResource); +} +void PetApi::setPetApiPetPetIdResource(std::shared_ptr spPetApiPetPetIdResource) { + m_spPetApiPetPetIdResource = spPetApiPetPetIdResource; + m_service->publish(m_spPetApiPetPetIdResource); +} +void PetApi::setPetApiPetFindByStatusResource(std::shared_ptr spPetApiPetFindByStatusResource) { + m_spPetApiPetFindByStatusResource = spPetApiPetFindByStatusResource; + m_service->publish(m_spPetApiPetFindByStatusResource); +} +void PetApi::setPetApiPetFindByTagsResource(std::shared_ptr spPetApiPetFindByTagsResource) { + m_spPetApiPetFindByTagsResource = spPetApiPetFindByTagsResource; + m_service->publish(m_spPetApiPetFindByTagsResource); +} +void PetApi::setPetApiPetPetIdUploadImageResource(std::shared_ptr spPetApiPetPetIdUploadImageResource) { + m_spPetApiPetPetIdUploadImageResource = spPetApiPetPetIdUploadImageResource; + m_service->publish(m_spPetApiPetPetIdUploadImageResource); +} + + +void PetApi::publishDefaultResources() { + if (!m_spPetApiPetResource) { + setPetApiPetResource(std::make_shared()); + } + if (!m_spPetApiPetPetIdResource) { + setPetApiPetPetIdResource(std::make_shared()); + } + if (!m_spPetApiPetFindByStatusResource) { + setPetApiPetFindByStatusResource(std::make_shared()); + } + if (!m_spPetApiPetFindByTagsResource) { + setPetApiPetFindByTagsResource(std::make_shared()); + } + if (!m_spPetApiPetPetIdUploadImageResource) { + setPetApiPetPetIdUploadImageResource(std::make_shared()); + } +} + +std::shared_ptr PetApi::service() { + return m_service; +} } diff --git a/samples/server/petstore/cpp-restbed/api/PetApi.h b/samples/server/petstore/cpp-restbed/api/PetApi.h index 2512275920d..09a6770a953 100644 --- a/samples/server/petstore/cpp-restbed/api/PetApi.h +++ b/samples/server/petstore/cpp-restbed/api/PetApi.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -22,10 +22,13 @@ #include #include +#include #include #include +#include #include +#include #include "ApiResponse.h" #include "Pet.h" @@ -38,6 +41,22 @@ namespace api { using namespace org::openapitools::server::model; +/// +/// Exception to flag problems in the handlers +/// +class PetApiException: public std::exception +{ +public: + PetApiException(int status_code, std::string what); + + int getStatus() const; + const char* what() const noexcept override; + +private: + int m_status; + std::string m_what; +}; + /// /// Add a new pet to the store /// @@ -47,35 +66,48 @@ using namespace org::openapitools::server::model; class PetApiPetResource: public restbed::Resource { public: - PetApiPetResource(); + PetApiPetResource(const std::string& context = "/v2"); virtual ~PetApiPetResource(); - void POST_method_handler(const std::shared_ptr session); - void PUT_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - std::shared_ptr const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// - void set_handler_PUT( - std::function( - std::shared_ptr const & - )> handler - ); + virtual int handler_POST( + std::shared_ptr const & body); + + virtual int handler_PUT( + std::shared_ptr const & body); + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::shared_ptr const & - )> handler_POST_; - - std::function( - std::shared_ptr const & - )> handler_PUT_; - - std::shared_ptr body{}; + void handler_POST_internal(const std::shared_ptr session); + void handler_PUT_internal(const std::shared_ptr session); }; + /// /// Deletes a pet /// @@ -85,36 +117,69 @@ private: class PetApiPetPetIdResource: public restbed::Resource { public: - PetApiPetPetIdResource(); + PetApiPetPetIdResource(const std::string& context = "/v2"); virtual ~PetApiPetPetIdResource(); - void DELETE_method_handler(const std::shared_ptr session); - void POST_method_handler(const std::shared_ptr session); - void set_handler_DELETE( - std::function( - int64_t const &, std::string const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// - void set_handler_POST( - std::function( - int64_t const &, std::string const &, std::string const & - )> handler - ); + virtual int handler_DELETE( + int64_t const & petId, std::string const & apiKey); + + virtual std::pair> handler_GET( + int64_t const & petId); + virtual int handler_POST( + int64_t const & petId, std::string const & name, std::string const & status); + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + virtual int64_t getPathParam_petId(const std::shared_ptr& request) + { + return request->get_path_parameter("petId", 0L); + } + + virtual std::string getHeader_api_key(const std::shared_ptr& request) + { + return request->get_header("api_key", ""); + } + + + virtual int64_t getPathParam_petId_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("petId", 0L); + } + virtual int64_t getPathParam_petId_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("petId", 0L); + } + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - int64_t const &, std::string const & - )> handler_DELETE_; - - std::function( - int64_t const &, std::string const &, std::string const & - )> handler_POST_; - - int64_t petId{}; - std::string apiKey{}; + void handler_DELETE_internal(const std::shared_ptr session); + void handler_GET_internal(const std::shared_ptr session); + void handler_POST_internal(const std::shared_ptr session); }; + /// /// Finds Pets by status /// @@ -124,26 +189,45 @@ private: class PetApiPetFindByStatusResource: public restbed::Resource { public: - PetApiPetFindByStatusResource(); + PetApiPetFindByStatusResource(const std::string& context = "/v2"); virtual ~PetApiPetFindByStatusResource(); - void GET_method_handler(const std::shared_ptr session); - void set_handler_GET( - std::function( - std::vector const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair>> handler_GET( + std::vector const & status); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::vector const & - )> handler_GET_; - - - std::vector status{}; + void handler_GET_internal(const std::shared_ptr session); }; + /// /// Finds Pets by tags /// @@ -153,26 +237,45 @@ private: class PetApiPetFindByTagsResource: public restbed::Resource { public: - PetApiPetFindByTagsResource(); + PetApiPetFindByTagsResource(const std::string& context = "/v2"); virtual ~PetApiPetFindByTagsResource(); - void GET_method_handler(const std::shared_ptr session); - void set_handler_GET( - std::function( - std::vector const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair>> handler_GET( + std::vector const & tags); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::vector const & - )> handler_GET_; - - - std::vector tags{}; + void handler_GET_internal(const std::shared_ptr session); }; + /// /// uploads an image /// @@ -182,46 +285,79 @@ private: class PetApiPetPetIdUploadImageResource: public restbed::Resource { public: - PetApiPetPetIdUploadImageResource(); + PetApiPetPetIdUploadImageResource(const std::string& context = "/v2"); virtual ~PetApiPetPetIdUploadImageResource(); - void POST_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - int64_t const &, std::string const &, std::string const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair> handler_POST( + int64_t const & petId, std::string const & additionalMetadata, std::string const & file); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + virtual int64_t getPathParam_petId(const std::shared_ptr& request) + { + return request->get_path_parameter("petId", 0L); + } + + + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - int64_t const &, std::string const &, std::string const & - )> handler_POST_; - - - int64_t petId{}; - std::string additionalMetadata{}; - std::string file{}; + void handler_POST_internal(const std::shared_ptr session); }; + // // The restbed service to actually implement the REST server // -class PetApi: public restbed::Service +class PetApi { public: - PetApi(); - ~PetApi(); - void startService(int const& port); - void stopService(); - + explicit PetApi(std::shared_ptr const& restbedService); + virtual ~PetApi(); + + virtual void setPetApiPetResource(std::shared_ptr spPetApiPetResource); + virtual void setPetApiPetPetIdResource(std::shared_ptr spPetApiPetPetIdResource); + virtual void setPetApiPetFindByStatusResource(std::shared_ptr spPetApiPetFindByStatusResource); + virtual void setPetApiPetFindByTagsResource(std::shared_ptr spPetApiPetFindByTagsResource); + virtual void setPetApiPetPetIdUploadImageResource(std::shared_ptr spPetApiPetPetIdUploadImageResource); + + virtual void publishDefaultResources(); + + virtual std::shared_ptr service(); + protected: std::shared_ptr m_spPetApiPetResource; std::shared_ptr m_spPetApiPetPetIdResource; std::shared_ptr m_spPetApiPetFindByStatusResource; std::shared_ptr m_spPetApiPetFindByTagsResource; std::shared_ptr m_spPetApiPetPetIdUploadImageResource; + +private: + std::shared_ptr m_service; }; diff --git a/samples/server/petstore/cpp-restbed/api/StoreApi.cpp b/samples/server/petstore/cpp-restbed/api/StoreApi.cpp index 3fb05fb7493..784232c6112 100644 --- a/samples/server/petstore/cpp-restbed/api/StoreApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/StoreApi.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "StoreApi.h" @@ -25,45 +30,71 @@ namespace api { using namespace org::openapitools::server::model; -StoreApi::StoreApi() { -} - -StoreApi::~StoreApi() {} - -void StoreApi::startService(int const& port) { - // A typical pattern is to derive a class from StoreApi and allocate the shared pointers for restbed::Resource objects - // and manipulate them (e.g. binding GET/POST handler functions) before this startService() gets called. - // In such a case we want to use our m_spXXX variables. - // However in case these shared pointers are nullptr, then allocate the restbed::Resources now: - if (!m_spStoreApiStoreOrderOrderIdResource) - m_spStoreApiStoreOrderOrderIdResource = std::make_shared(); - this->publish(m_spStoreApiStoreOrderOrderIdResource); - if (!m_spStoreApiStoreInventoryResource) - m_spStoreApiStoreInventoryResource = std::make_shared(); - this->publish(m_spStoreApiStoreInventoryResource); - if (!m_spStoreApiStoreOrderResource) - m_spStoreApiStoreOrderResource = std::make_shared(); - this->publish(m_spStoreApiStoreOrderResource); - - std::shared_ptr settings = std::make_shared(); - settings->set_port(port); - settings->set_root("/v2"); - - this->start(settings); -} - -void StoreApi::stopService() { - this->stop(); -} - -StoreApiStoreOrderOrderIdResource::StoreApiStoreOrderOrderIdResource() +StoreApiException::StoreApiException(int status_code, std::string what) + : m_status(status_code), + m_what(what) { - this->set_path("/store/order/{orderId: .*}/"); + +} +int StoreApiException::getStatus() const +{ + return m_status; +} +const char* StoreApiException::what() const noexcept +{ + return m_what.c_str(); +} + + +template +std::shared_ptr extractJsonModelBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto model = std::make_shared(pt); + return model; +} + +template +std::vector> extractJsonArrayBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto arrayRet = std::vector>(); + for (const auto& child: pt) { + arrayRet.emplace_back(std::make_shared(child.second)); + } + return arrayRet; +} + +template +std::string convertMapResponse(const std::map& map) +{ + boost::property_tree::ptree pt; + for(const auto &kv: map) { + pt.push_back(boost::property_tree::ptree::value_type( + boost::lexical_cast(kv.first), + boost::property_tree::ptree( + boost::lexical_cast(kv.second)))); + } + std::stringstream sstream; + write_json(sstream, pt); + std::string result = sstream.str(); + return result; +} + +StoreApiStoreOrderOrderIdResource::StoreApiStoreOrderOrderIdResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/store/order/{orderId: .*}/"); this->set_method_handler("DELETE", - std::bind(&StoreApiStoreOrderOrderIdResource::DELETE_method_handler, this, + std::bind(&StoreApiStoreOrderOrderIdResource::handler_DELETE_internal, this, std::placeholders::_1)); this->set_method_handler("GET", - std::bind(&StoreApiStoreOrderOrderIdResource::GET_method_handler, this, + std::bind(&StoreApiStoreOrderOrderIdResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -71,93 +102,155 @@ StoreApiStoreOrderOrderIdResource::~StoreApiStoreOrderOrderIdResource() { } -void StoreApiStoreOrderOrderIdResource::set_handler_DELETE( - std::function( - std::string const & - )> handler) { - handler_DELETE_ = std::move(handler); -} - -void StoreApiStoreOrderOrderIdResource::set_handler_GET( - std::function( - int64_t const & - )> handler) { - handler_GET_ = std::move(handler); -} - -void StoreApiStoreOrderOrderIdResource::DELETE_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const std::string orderId = request->get_path_parameter("orderId", ""); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_DELETE_) - { - std::tie(status_code, result) = handler_DELETE_( - orderId - ); - } - - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid ID supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 404) { - session->close(404, result.empty() ? "Order not found" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - -void StoreApiStoreOrderOrderIdResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const int64_t orderId = request->get_path_parameter("orderId", 0L); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - orderId - ); - } - - if (status_code == 200) { - std::shared_ptr response = NULL; - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid ID supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 404) { - session->close(404, result.empty() ? "Order not found" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - -StoreApiStoreInventoryResource::StoreApiStoreInventoryResource() +std::pair StoreApiStoreOrderOrderIdResource::handleStoreApiException(const StoreApiException& e) { - this->set_path("/store/inventory/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair StoreApiStoreOrderOrderIdResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair StoreApiStoreOrderOrderIdResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void StoreApiStoreOrderOrderIdResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void StoreApiStoreOrderOrderIdResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void StoreApiStoreOrderOrderIdResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void StoreApiStoreOrderOrderIdResource::handler_DELETE_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + // Getting the path params + const std::string orderId = getPathParam_orderId(request); + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_DELETE(orderId); + } + catch(const StoreApiException& e) { + std::tie(status_code, result) = handleStoreApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid ID supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "Order not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +// x-extension +void StoreApiStoreOrderOrderIdResource::handler_GET_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + + // Getting the path params + const int64_t orderId = getPathParam_orderId_x_extension(request); + + + int status_code = 500; + std::shared_ptr resultObject = std::make_shared(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(orderId); + } + catch(const StoreApiException& e) { + std::tie(status_code, result) = handleStoreApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject->toJsonString(); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid ID supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "Order not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +int StoreApiStoreOrderOrderIdResource::handler_DELETE( + std::string const & orderId) +{ + throw StoreApiException(501, "Not implemented"); +} + +std::pair> StoreApiStoreOrderOrderIdResource::handler_GET( + int64_t const & orderId) +{ + throw StoreApiException(501, "Not implemented"); +} + +std::string StoreApiStoreOrderOrderIdResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +StoreApiStoreInventoryResource::StoreApiStoreInventoryResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/store/inventory/"); this->set_method_handler("GET", - std::bind(&StoreApiStoreInventoryResource::GET_method_handler, this, + std::bind(&StoreApiStoreInventoryResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -165,46 +258,96 @@ StoreApiStoreInventoryResource::~StoreApiStoreInventoryResource() { } -void StoreApiStoreInventoryResource::set_handler_GET( - std::function( - - )> handler) { - handler_GET_ = std::move(handler); -} - - -void StoreApiStoreInventoryResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - - ); - } - - if (status_code == 200) { - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - - -StoreApiStoreOrderResource::StoreApiStoreOrderResource() +std::pair StoreApiStoreInventoryResource::handleStoreApiException(const StoreApiException& e) { - this->set_path("/store/order/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair StoreApiStoreInventoryResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair StoreApiStoreInventoryResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void StoreApiStoreInventoryResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void StoreApiStoreInventoryResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void StoreApiStoreInventoryResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void StoreApiStoreInventoryResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + + + + int status_code = 500; + std::map resultObject = std::map(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(); + } + catch(const StoreApiException& e) { + std::tie(status_code, result) = handleStoreApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = convertMapResponse(resultObject); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +std::pair> StoreApiStoreInventoryResource::handler_GET( + ) +{ + throw StoreApiException(501, "Not implemented"); +} + + +std::string StoreApiStoreInventoryResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +StoreApiStoreOrderResource::StoreApiStoreOrderResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/store/order/"); this->set_method_handler("POST", - std::bind(&StoreApiStoreOrderResource::POST_method_handler, this, + std::bind(&StoreApiStoreOrderResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -212,56 +355,138 @@ StoreApiStoreOrderResource::~StoreApiStoreOrderResource() { } -void StoreApiStoreOrderResource::set_handler_POST( - std::function( - std::shared_ptr const & - )> handler) { - handler_POST_ = std::move(handler); +std::pair StoreApiStoreOrderResource::handleStoreApiException(const StoreApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair StoreApiStoreOrderResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair StoreApiStoreOrderResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void StoreApiStoreOrderResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void StoreApiStoreOrderResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void StoreApiStoreOrderResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void StoreApiStoreOrderResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + auto body = extractJsonModelBodyParam(bodyContent); + + + + + int status_code = 500; + std::shared_ptr resultObject = std::make_shared(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_POST(body); + } + catch(const StoreApiException& e) { + std::tie(status_code, result) = handleStoreApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject->toJsonString(); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid Order" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); } -void StoreApiStoreOrderResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - body - ); - } - - if (status_code == 200) { - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid Order" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); +std::pair> StoreApiStoreOrderResource::handler_POST( + std::shared_ptr const & body) +{ + throw StoreApiException(501, "Not implemented"); } +std::string StoreApiStoreOrderResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +StoreApi::StoreApi(std::shared_ptr const& restbedService) +: m_service(restbedService) +{ +} + +StoreApi::~StoreApi() {} + +void StoreApi::setStoreApiStoreOrderOrderIdResource(std::shared_ptr spStoreApiStoreOrderOrderIdResource) { + m_spStoreApiStoreOrderOrderIdResource = spStoreApiStoreOrderOrderIdResource; + m_service->publish(m_spStoreApiStoreOrderOrderIdResource); +} +void StoreApi::setStoreApiStoreInventoryResource(std::shared_ptr spStoreApiStoreInventoryResource) { + m_spStoreApiStoreInventoryResource = spStoreApiStoreInventoryResource; + m_service->publish(m_spStoreApiStoreInventoryResource); +} +void StoreApi::setStoreApiStoreOrderResource(std::shared_ptr spStoreApiStoreOrderResource) { + m_spStoreApiStoreOrderResource = spStoreApiStoreOrderResource; + m_service->publish(m_spStoreApiStoreOrderResource); +} + + +void StoreApi::publishDefaultResources() { + if (!m_spStoreApiStoreOrderOrderIdResource) { + setStoreApiStoreOrderOrderIdResource(std::make_shared()); + } + if (!m_spStoreApiStoreInventoryResource) { + setStoreApiStoreInventoryResource(std::make_shared()); + } + if (!m_spStoreApiStoreOrderResource) { + setStoreApiStoreOrderResource(std::make_shared()); + } +} + +std::shared_ptr StoreApi::service() { + return m_service; +} } diff --git a/samples/server/petstore/cpp-restbed/api/StoreApi.h b/samples/server/petstore/cpp-restbed/api/StoreApi.h index 7089e9f6bc2..3c14a48c7e9 100644 --- a/samples/server/petstore/cpp-restbed/api/StoreApi.h +++ b/samples/server/petstore/cpp-restbed/api/StoreApi.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -22,10 +22,13 @@ #include #include +#include #include #include +#include #include +#include #include "Order.h" #include @@ -38,6 +41,22 @@ namespace api { using namespace org::openapitools::server::model; +/// +/// Exception to flag problems in the handlers +/// +class StoreApiException: public std::exception +{ +public: + StoreApiException(int status_code, std::string what); + + int getStatus() const; + const char* what() const noexcept override; + +private: + int m_status; + std::string m_what; +}; + /// /// Delete purchase order by ID /// @@ -47,35 +66,57 @@ using namespace org::openapitools::server::model; class StoreApiStoreOrderOrderIdResource: public restbed::Resource { public: - StoreApiStoreOrderOrderIdResource(); + StoreApiStoreOrderOrderIdResource(const std::string& context = "/v2"); virtual ~StoreApiStoreOrderOrderIdResource(); - void DELETE_method_handler(const std::shared_ptr session); - void GET_method_handler(const std::shared_ptr session); - void set_handler_DELETE( - std::function( - std::string const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// - void set_handler_GET( - std::function( - int64_t const & - )> handler - ); + virtual int handler_DELETE( + std::string const & orderId); + + virtual std::pair> handler_GET( + int64_t const & orderId); + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + virtual std::string getPathParam_orderId(const std::shared_ptr& request) + { + return request->get_path_parameter("orderId", ""); + } + + + virtual int64_t getPathParam_orderId_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("orderId", 0L); + } + + virtual std::pair handleStoreApiException(const StoreApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::string const & - )> handler_DELETE_; - - std::function( - int64_t const & - )> handler_GET_; - - std::string orderId{}; + void handler_DELETE_internal(const std::shared_ptr session); + void handler_GET_internal(const std::shared_ptr session); }; + /// /// Returns pet inventories by status /// @@ -85,25 +126,45 @@ private: class StoreApiStoreInventoryResource: public restbed::Resource { public: - StoreApiStoreInventoryResource(); + StoreApiStoreInventoryResource(const std::string& context = "/v2"); virtual ~StoreApiStoreInventoryResource(); - void GET_method_handler(const std::shared_ptr session); - void set_handler_GET( - std::function( - - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair> handler_GET( + ); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleStoreApiException(const StoreApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - - )> handler_GET_; - - + void handler_GET_internal(const std::shared_ptr session); }; + /// /// Place an order for a pet /// @@ -113,42 +174,70 @@ private: class StoreApiStoreOrderResource: public restbed::Resource { public: - StoreApiStoreOrderResource(); + StoreApiStoreOrderResource(const std::string& context = "/v2"); virtual ~StoreApiStoreOrderResource(); - void POST_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - std::shared_ptr const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair> handler_POST( + std::shared_ptr const & body); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleStoreApiException(const StoreApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::shared_ptr const & - )> handler_POST_; - - - std::shared_ptr body{}; + void handler_POST_internal(const std::shared_ptr session); }; + // // The restbed service to actually implement the REST server // -class StoreApi: public restbed::Service +class StoreApi { public: - StoreApi(); - ~StoreApi(); - void startService(int const& port); - void stopService(); - + explicit StoreApi(std::shared_ptr const& restbedService); + virtual ~StoreApi(); + + virtual void setStoreApiStoreOrderOrderIdResource(std::shared_ptr spStoreApiStoreOrderOrderIdResource); + virtual void setStoreApiStoreInventoryResource(std::shared_ptr spStoreApiStoreInventoryResource); + virtual void setStoreApiStoreOrderResource(std::shared_ptr spStoreApiStoreOrderResource); + + virtual void publishDefaultResources(); + + virtual std::shared_ptr service(); + protected: std::shared_ptr m_spStoreApiStoreOrderOrderIdResource; std::shared_ptr m_spStoreApiStoreInventoryResource; std::shared_ptr m_spStoreApiStoreOrderResource; + +private: + std::shared_ptr m_service; }; diff --git a/samples/server/petstore/cpp-restbed/api/UserApi.cpp b/samples/server/petstore/cpp-restbed/api/UserApi.cpp index a1630121cf5..c6485c6e129 100644 --- a/samples/server/petstore/cpp-restbed/api/UserApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/UserApi.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "UserApi.h" @@ -25,51 +30,68 @@ namespace api { using namespace org::openapitools::server::model; -UserApi::UserApi() { -} - -UserApi::~UserApi() {} - -void UserApi::startService(int const& port) { - // A typical pattern is to derive a class from UserApi and allocate the shared pointers for restbed::Resource objects - // and manipulate them (e.g. binding GET/POST handler functions) before this startService() gets called. - // In such a case we want to use our m_spXXX variables. - // However in case these shared pointers are nullptr, then allocate the restbed::Resources now: - if (!m_spUserApiUserResource) - m_spUserApiUserResource = std::make_shared(); - this->publish(m_spUserApiUserResource); - if (!m_spUserApiUserCreateWithArrayResource) - m_spUserApiUserCreateWithArrayResource = std::make_shared(); - this->publish(m_spUserApiUserCreateWithArrayResource); - if (!m_spUserApiUserCreateWithListResource) - m_spUserApiUserCreateWithListResource = std::make_shared(); - this->publish(m_spUserApiUserCreateWithListResource); - if (!m_spUserApiUserUsernameResource) - m_spUserApiUserUsernameResource = std::make_shared(); - this->publish(m_spUserApiUserUsernameResource); - if (!m_spUserApiUserLoginResource) - m_spUserApiUserLoginResource = std::make_shared(); - this->publish(m_spUserApiUserLoginResource); - if (!m_spUserApiUserLogoutResource) - m_spUserApiUserLogoutResource = std::make_shared(); - this->publish(m_spUserApiUserLogoutResource); - - std::shared_ptr settings = std::make_shared(); - settings->set_port(port); - settings->set_root("/v2"); - - this->start(settings); -} - -void UserApi::stopService() { - this->stop(); -} - -UserApiUserResource::UserApiUserResource() +UserApiException::UserApiException(int status_code, std::string what) + : m_status(status_code), + m_what(what) { - this->set_path("/user/"); + +} +int UserApiException::getStatus() const +{ + return m_status; +} +const char* UserApiException::what() const noexcept +{ + return m_what.c_str(); +} + + +template +std::shared_ptr extractJsonModelBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto model = std::make_shared(pt); + return model; +} + +template +std::vector> extractJsonArrayBodyParam(const std::string& bodyContent) +{ + std::stringstream sstream(bodyContent); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream, pt); + + auto arrayRet = std::vector>(); + for (const auto& child: pt) { + arrayRet.emplace_back(std::make_shared(child.second)); + } + return arrayRet; +} + +template +std::string convertMapResponse(const std::map& map) +{ + boost::property_tree::ptree pt; + for(const auto &kv: map) { + pt.push_back(boost::property_tree::ptree::value_type( + boost::lexical_cast(kv.first), + boost::property_tree::ptree( + boost::lexical_cast(kv.second)))); + } + std::stringstream sstream; + write_json(sstream, pt); + std::string result = sstream.str(); + return result; +} + +UserApiUserResource::UserApiUserResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/"); this->set_method_handler("POST", - std::bind(&UserApiUserResource::POST_method_handler, this, + std::bind(&UserApiUserResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -77,58 +99,98 @@ UserApiUserResource::~UserApiUserResource() { } -void UserApiUserResource::set_handler_POST( - std::function( - std::shared_ptr const & - )> handler) { - handler_POST_ = std::move(handler); -} - - -void UserApiUserResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - body - ); - } - - if (status_code == 0) { - session->close(0, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - - - -UserApiUserCreateWithArrayResource::UserApiUserCreateWithArrayResource() +std::pair UserApiUserResource::handleUserApiException(const UserApiException& e) { - this->set_path("/user/createWithArray/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + auto body = extractJsonModelBodyParam(bodyContent); + + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(body); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 0) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 0, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +int UserApiUserResource::handler_POST( + std::shared_ptr const & body) +{ + throw UserApiException(501, "Not implemented"); +} + + +std::string UserApiUserResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +UserApiUserCreateWithArrayResource::UserApiUserCreateWithArrayResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/createWithArray/"); this->set_method_handler("POST", - std::bind(&UserApiUserCreateWithArrayResource::POST_method_handler, this, + std::bind(&UserApiUserCreateWithArrayResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -136,58 +198,98 @@ UserApiUserCreateWithArrayResource::~UserApiUserCreateWithArrayResource() { } -void UserApiUserCreateWithArrayResource::set_handler_POST( - std::function( - std::vector> const & - )> handler) { - handler_POST_ = std::move(handler); -} - - -void UserApiUserCreateWithArrayResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - body - ); - } - - if (status_code == 0) { - session->close(0, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - - - -UserApiUserCreateWithListResource::UserApiUserCreateWithListResource() +std::pair UserApiUserCreateWithArrayResource::handleUserApiException(const UserApiException& e) { - this->set_path("/user/createWithList/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserCreateWithArrayResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserCreateWithArrayResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserCreateWithArrayResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserCreateWithArrayResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserCreateWithArrayResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserCreateWithArrayResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + auto body = extractJsonArrayBodyParam(bodyContent); + + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(body); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 0) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 0, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +int UserApiUserCreateWithArrayResource::handler_POST( + std::vector> const & body) +{ + throw UserApiException(501, "Not implemented"); +} + + +std::string UserApiUserCreateWithArrayResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +UserApiUserCreateWithListResource::UserApiUserCreateWithListResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/createWithList/"); this->set_method_handler("POST", - std::bind(&UserApiUserCreateWithListResource::POST_method_handler, this, + std::bind(&UserApiUserCreateWithListResource::handler_POST_internal, this, std::placeholders::_1)); } @@ -195,61 +297,104 @@ UserApiUserCreateWithListResource::~UserApiUserCreateWithListResource() { } -void UserApiUserCreateWithListResource::set_handler_POST( - std::function( - std::vector> const & - )> handler) { - handler_POST_ = std::move(handler); -} - - -void UserApiUserCreateWithListResource::POST_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - /** - * Get body params or form params here from the file string - */ - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_POST_) - { - std::tie(status_code, result) = handler_POST_( - body - ); - } - - if (status_code == 0) { - session->close(0, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - - - -UserApiUserUsernameResource::UserApiUserUsernameResource() +std::pair UserApiUserCreateWithListResource::handleUserApiException(const UserApiException& e) { - this->set_path("/user/{username: .*}/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserCreateWithListResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserCreateWithListResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserCreateWithListResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserCreateWithListResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserCreateWithListResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserCreateWithListResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // Get body params or form params here from the body content string + auto body = extractJsonArrayBodyParam(bodyContent); + + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(body); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 0) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 0, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +int UserApiUserCreateWithListResource::handler_POST( + std::vector> const & body) +{ + throw UserApiException(501, "Not implemented"); +} + + +std::string UserApiUserCreateWithListResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +UserApiUserUsernameResource::UserApiUserUsernameResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/{username: .*}/"); this->set_method_handler("DELETE", - std::bind(&UserApiUserUsernameResource::DELETE_method_handler, this, + std::bind(&UserApiUserUsernameResource::handler_DELETE_internal, this, + std::placeholders::_1)); + this->set_method_handler("GET", + std::bind(&UserApiUserUsernameResource::handler_GET_internal, this, std::placeholders::_1)); this->set_method_handler("PUT", - std::bind(&UserApiUserUsernameResource::PUT_method_handler, this, + std::bind(&UserApiUserUsernameResource::handler_PUT_internal, this, std::placeholders::_1)); } @@ -257,97 +402,205 @@ UserApiUserUsernameResource::~UserApiUserUsernameResource() { } -void UserApiUserUsernameResource::set_handler_DELETE( - std::function( - std::string const & - )> handler) { - handler_DELETE_ = std::move(handler); -} - -void UserApiUserUsernameResource::set_handler_PUT( - std::function( - std::string const &, std::shared_ptr const & - )> handler) { - handler_PUT_ = std::move(handler); -} - -void UserApiUserUsernameResource::DELETE_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - // Getting the path params - const std::string username = request->get_path_parameter("username", ""); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_DELETE_) - { - std::tie(status_code, result) = handler_DELETE_( - username - ); - } - - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid username supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 404) { - session->close(404, result.empty() ? "User not found" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - -void UserApiUserUsernameResource::PUT_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - // Body params are present, therefore we have to fetch them - int content_length = request->get_header("Content-Length", 0); - session->fetch(content_length, - [ this ]( const std::shared_ptr session, const restbed::Bytes & body ) - { - - const auto request = session->get_request(); - std::string file = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( )); - - // Getting the path params - const std::string username = request->get_path_parameter("username", ""); - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_PUT_) - { - std::tie(status_code, result) = handler_PUT_( - username, body - ); - } - - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid user supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 404) { - session->close(404, result.empty() ? "User not found" : std::move(result), { {"Connection", "close"} }); - return; - } - - }); -} - - -UserApiUserLoginResource::UserApiUserLoginResource() +std::pair UserApiUserUsernameResource::handleUserApiException(const UserApiException& e) { - this->set_path("/user/login/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserUsernameResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserUsernameResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserUsernameResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserUsernameResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserUsernameResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserUsernameResource::handler_DELETE_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + // Getting the path params + const std::string username = getPathParam_username(request); + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_DELETE(username); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid username supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "User not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +// x-extension +void UserApiUserUsernameResource::handler_GET_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + + // Getting the path params + const std::string username = getPathParam_username_x_extension(request); + + + int status_code = 500; + std::shared_ptr resultObject = std::make_shared(); + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(username); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject->toJsonString(); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid username supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "User not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} +// x-extension +void UserApiUserUsernameResource::handler_PUT_internal(const std::shared_ptr session) { + + const auto request = session->get_request(); + std::string bodyContent = extractBodyContent(session); + + // body params or form params here from the body content string + auto username = std::make_shared<>(bodyContent); + auto body = extractJsonModelBodyParam(bodyContent); + + // Getting the path params + const std::string username = getPathParam_username_x_extension(request); + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_PUT(username, body); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid user supplied" : result, contentType); + return; + } + if (status_code == 404) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 404, result.empty() ? "User not found" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + +int UserApiUserUsernameResource::handler_DELETE( + std::string const & username) +{ + throw UserApiException(501, "Not implemented"); +} + +std::pair> UserApiUserUsernameResource::handler_GET( + std::string const & username) +{ + throw UserApiException(501, "Not implemented"); +} +int UserApiUserUsernameResource::handler_PUT( + std::string const & username, std::shared_ptr const & body) +{ + throw UserApiException(501, "Not implemented"); +} + +std::string UserApiUserUsernameResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +UserApiUserLoginResource::UserApiUserLoginResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/login/"); this->set_method_handler("GET", - std::bind(&UserApiUserLoginResource::GET_method_handler, this, + std::bind(&UserApiUserLoginResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -355,57 +608,109 @@ UserApiUserLoginResource::~UserApiUserLoginResource() { } -void UserApiUserLoginResource::set_handler_GET( - std::function( - std::string const &, std::string const & - )> handler) { - handler_GET_ = std::move(handler); -} - - -void UserApiUserLoginResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - - // Getting the query params - const std::string username = request->get_query_parameter("username", ""); - const std::string password = request->get_query_parameter("password", ""); - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - username, password - ); - } - - if (status_code == 200) { - // Description: calls per hour allowed by the user - session->set_header("X-Rate-Limit", ""); // Change second param to your header value - // Description: date in UTC when toekn expires - session->set_header("X-Expires-After", ""); // Change second param to your header value - session->close(200, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - if (status_code == 400) { - session->close(400, result.empty() ? "Invalid username/password supplied" : std::move(result), { {"Connection", "close"} }); - return; - } - -} - - - -UserApiUserLogoutResource::UserApiUserLogoutResource() +std::pair UserApiUserLoginResource::handleUserApiException(const UserApiException& e) { - this->set_path("/user/logout/"); + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserLoginResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserLoginResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserLoginResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserLoginResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserLoginResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserLoginResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + + // Getting the query params + const std::string username = getQueryParam_username(request); + const std::string password = getQueryParam_password(request); + + + int status_code = 500; + std::string resultObject = ""; + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(username, password); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 200) { + result = resultObject; + // Description: calls per hour allowed by the user + setResponseHeader(session, "X-Rate-Limit"); + // Description: date in UTC when toekn expires + setResponseHeader(session, "X-Expires-After"); + + const constexpr auto contentType = "application/json"; + returnResponse(session, 200, result.empty() ? "successful operation" : result, contentType); + return; + } + if (status_code == 400) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 400, result.empty() ? "Invalid username/password supplied" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); +} + + +std::pair UserApiUserLoginResource::handler_GET( + std::string const & username, std::string const & password) +{ + throw UserApiException(501, "Not implemented"); +} + + +std::string UserApiUserLoginResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} +UserApiUserLogoutResource::UserApiUserLogoutResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/user/logout/"); this->set_method_handler("GET", - std::bind(&UserApiUserLogoutResource::GET_method_handler, this, + std::bind(&UserApiUserLogoutResource::handler_GET_internal, this, std::placeholders::_1)); } @@ -413,40 +718,147 @@ UserApiUserLogoutResource::~UserApiUserLogoutResource() { } -void UserApiUserLogoutResource::set_handler_GET( - std::function( - - )> handler) { - handler_GET_ = std::move(handler); +std::pair UserApiUserLogoutResource::handleUserApiException(const UserApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair UserApiUserLogoutResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair UserApiUserLogoutResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void UserApiUserLogoutResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void UserApiUserLogoutResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, const std::string& contentType) +{ + session->close(status, result, { {"Connection", "close"}, {"Content-Type", contentType} }); +} + +void UserApiUserLogoutResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void UserApiUserLogoutResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + + + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_GET(); + } + catch(const UserApiException& e) { + std::tie(status_code, result) = handleUserApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + if (status_code == 0) { + + const constexpr auto contentType = "text/plain"; + returnResponse(session, 0, result.empty() ? "successful operation" : result, contentType); + return; + } + defaultSessionClose(session, status_code, result); } -void UserApiUserLogoutResource::GET_method_handler(const std::shared_ptr session) { - - const auto request = session->get_request(); - - - - - // Change the value of this variable to the appropriate response before sending the response - int status_code = 200; - std::string result = "successful operation"; - - if (handler_GET_) - { - std::tie(status_code, result) = handler_GET_( - - ); - } - - if (status_code == 0) { - session->close(0, result.empty() ? "successful operation" : std::move(result), { {"Connection", "close"} }); - return; - } - +int UserApiUserLogoutResource::handler_GET( + ) +{ + throw UserApiException(501, "Not implemented"); } +std::string UserApiUserLogoutResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +UserApi::UserApi(std::shared_ptr const& restbedService) +: m_service(restbedService) +{ +} + +UserApi::~UserApi() {} + +void UserApi::setUserApiUserResource(std::shared_ptr spUserApiUserResource) { + m_spUserApiUserResource = spUserApiUserResource; + m_service->publish(m_spUserApiUserResource); +} +void UserApi::setUserApiUserCreateWithArrayResource(std::shared_ptr spUserApiUserCreateWithArrayResource) { + m_spUserApiUserCreateWithArrayResource = spUserApiUserCreateWithArrayResource; + m_service->publish(m_spUserApiUserCreateWithArrayResource); +} +void UserApi::setUserApiUserCreateWithListResource(std::shared_ptr spUserApiUserCreateWithListResource) { + m_spUserApiUserCreateWithListResource = spUserApiUserCreateWithListResource; + m_service->publish(m_spUserApiUserCreateWithListResource); +} +void UserApi::setUserApiUserUsernameResource(std::shared_ptr spUserApiUserUsernameResource) { + m_spUserApiUserUsernameResource = spUserApiUserUsernameResource; + m_service->publish(m_spUserApiUserUsernameResource); +} +void UserApi::setUserApiUserLoginResource(std::shared_ptr spUserApiUserLoginResource) { + m_spUserApiUserLoginResource = spUserApiUserLoginResource; + m_service->publish(m_spUserApiUserLoginResource); +} +void UserApi::setUserApiUserLogoutResource(std::shared_ptr spUserApiUserLogoutResource) { + m_spUserApiUserLogoutResource = spUserApiUserLogoutResource; + m_service->publish(m_spUserApiUserLogoutResource); +} + + +void UserApi::publishDefaultResources() { + if (!m_spUserApiUserResource) { + setUserApiUserResource(std::make_shared()); + } + if (!m_spUserApiUserCreateWithArrayResource) { + setUserApiUserCreateWithArrayResource(std::make_shared()); + } + if (!m_spUserApiUserCreateWithListResource) { + setUserApiUserCreateWithListResource(std::make_shared()); + } + if (!m_spUserApiUserUsernameResource) { + setUserApiUserUsernameResource(std::make_shared()); + } + if (!m_spUserApiUserLoginResource) { + setUserApiUserLoginResource(std::make_shared()); + } + if (!m_spUserApiUserLogoutResource) { + setUserApiUserLogoutResource(std::make_shared()); + } +} + +std::shared_ptr UserApi::service() { + return m_service; +} } diff --git a/samples/server/petstore/cpp-restbed/api/UserApi.h b/samples/server/petstore/cpp-restbed/api/UserApi.h index 9c4f4af73ee..ce692f0ea7f 100644 --- a/samples/server/petstore/cpp-restbed/api/UserApi.h +++ b/samples/server/petstore/cpp-restbed/api/UserApi.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -22,10 +22,13 @@ #include #include +#include #include #include +#include #include +#include #include "User.h" #include @@ -38,6 +41,22 @@ namespace api { using namespace org::openapitools::server::model; +/// +/// Exception to flag problems in the handlers +/// +class UserApiException: public std::exception +{ +public: + UserApiException(int status_code, std::string what); + + int getStatus() const; + const char* what() const noexcept override; + +private: + int m_status; + std::string m_what; +}; + /// /// Create user /// @@ -47,26 +66,45 @@ using namespace org::openapitools::server::model; class UserApiUserResource: public restbed::Resource { public: - UserApiUserResource(); + UserApiUserResource(const std::string& context = "/v2"); virtual ~UserApiUserResource(); - void POST_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - std::shared_ptr const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual int handler_POST( + std::shared_ptr const & body); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::shared_ptr const & - )> handler_POST_; - - - std::shared_ptr body{}; + void handler_POST_internal(const std::shared_ptr session); }; + /// /// Creates list of users with given input array /// @@ -76,26 +114,45 @@ private: class UserApiUserCreateWithArrayResource: public restbed::Resource { public: - UserApiUserCreateWithArrayResource(); + UserApiUserCreateWithArrayResource(const std::string& context = "/v2"); virtual ~UserApiUserCreateWithArrayResource(); - void POST_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - std::vector> const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual int handler_POST( + std::vector> const & body); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::vector> const & - )> handler_POST_; - - - std::vector> body{}; + void handler_POST_internal(const std::shared_ptr session); }; + /// /// Creates list of users with given input array /// @@ -105,26 +162,45 @@ private: class UserApiUserCreateWithListResource: public restbed::Resource { public: - UserApiUserCreateWithListResource(); + UserApiUserCreateWithListResource(const std::string& context = "/v2"); virtual ~UserApiUserCreateWithListResource(); - void POST_method_handler(const std::shared_ptr session); - void set_handler_POST( - std::function( - std::vector> const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual int handler_POST( + std::vector> const & body); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::vector> const & - )> handler_POST_; - - - std::vector> body{}; + void handler_POST_internal(const std::shared_ptr session); }; + /// /// Delete user /// @@ -134,35 +210,64 @@ private: class UserApiUserUsernameResource: public restbed::Resource { public: - UserApiUserUsernameResource(); + UserApiUserUsernameResource(const std::string& context = "/v2"); virtual ~UserApiUserUsernameResource(); - void DELETE_method_handler(const std::shared_ptr session); - void PUT_method_handler(const std::shared_ptr session); - void set_handler_DELETE( - std::function( - std::string const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// - void set_handler_PUT( - std::function( - std::string const &, std::shared_ptr const & - )> handler - ); + virtual int handler_DELETE( + std::string const & username); + + virtual std::pair> handler_GET( + std::string const & username); + virtual int handler_PUT( + std::string const & username, std::shared_ptr const & body); + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + virtual std::string getPathParam_username(const std::shared_ptr& request) + { + return request->get_path_parameter("username", ""); + } + + + virtual std::string getPathParam_username_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("username", ""); + } + virtual std::string getPathParam_username_x_extension(const std::shared_ptr& request) + { + return request->get_path_parameter("username", ""); + } + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::string const & - )> handler_DELETE_; - - std::function( - std::string const &, std::shared_ptr const & - )> handler_PUT_; - - std::string username{}; + void handler_DELETE_internal(const std::shared_ptr session); + void handler_GET_internal(const std::shared_ptr session); + void handler_PUT_internal(const std::shared_ptr session); }; + /// /// Logs user into the system /// @@ -172,27 +277,55 @@ private: class UserApiUserLoginResource: public restbed::Resource { public: - UserApiUserLoginResource(); + UserApiUserLoginResource(const std::string& context = "/v2"); virtual ~UserApiUserLoginResource(); - void GET_method_handler(const std::shared_ptr session); - void set_handler_GET( - std::function( - std::string const &, std::string const & - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual std::pair handler_GET( + std::string const & username, std::string const & password); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + virtual std::string getQueryParam_username(const std::shared_ptr& request) + { + return request->get_query_parameter("username", ""); + } + + virtual std::string getQueryParam_password(const std::shared_ptr& request) + { + return request->get_query_parameter("password", ""); + } + + + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - std::string const &, std::string const & - )> handler_GET_; - - - std::string username{}; - std::string password{}; + void handler_GET_internal(const std::shared_ptr session); }; + /// /// Logs out current logged in user session /// @@ -202,37 +335,66 @@ private: class UserApiUserLogoutResource: public restbed::Resource { public: - UserApiUserLogoutResource(); + UserApiUserLogoutResource(const std::string& context = "/v2"); virtual ~UserApiUserLogoutResource(); - void GET_method_handler(const std::shared_ptr session); - void set_handler_GET( - std::function( - - )> handler - ); +protected: + ////////////////////////////////////////////////////////// + // Override these to implement the server functionality // + ////////////////////////////////////////////////////////// + virtual int handler_GET( + ); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + + + + virtual std::pair handleUserApiException(const UserApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, const std::string& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); private: - std::function( - - )> handler_GET_; - - + void handler_GET_internal(const std::shared_ptr session); }; + // // The restbed service to actually implement the REST server // -class UserApi: public restbed::Service +class UserApi { public: - UserApi(); - ~UserApi(); - void startService(int const& port); - void stopService(); - + explicit UserApi(std::shared_ptr const& restbedService); + virtual ~UserApi(); + + virtual void setUserApiUserResource(std::shared_ptr spUserApiUserResource); + virtual void setUserApiUserCreateWithArrayResource(std::shared_ptr spUserApiUserCreateWithArrayResource); + virtual void setUserApiUserCreateWithListResource(std::shared_ptr spUserApiUserCreateWithListResource); + virtual void setUserApiUserUsernameResource(std::shared_ptr spUserApiUserUsernameResource); + virtual void setUserApiUserLoginResource(std::shared_ptr spUserApiUserLoginResource); + virtual void setUserApiUserLogoutResource(std::shared_ptr spUserApiUserLogoutResource); + + virtual void publishDefaultResources(); + + virtual std::shared_ptr service(); + protected: std::shared_ptr m_spUserApiUserResource; std::shared_ptr m_spUserApiUserCreateWithArrayResource; @@ -240,6 +402,9 @@ protected: std::shared_ptr m_spUserApiUserUsernameResource; std::shared_ptr m_spUserApiUserLoginResource; std::shared_ptr m_spUserApiUserLogoutResource; + +private: + std::shared_ptr m_service; }; diff --git a/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp b/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp index 9ebf3e6784d..502b298003e 100644 --- a/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp +++ b/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "ApiResponse.h" #include +#include #include +#include #include #include @@ -28,25 +30,39 @@ namespace openapitools { namespace server { namespace model { -ApiResponse::ApiResponse() +ApiResponse::ApiResponse(boost::property_tree::ptree const& pt) { - m_Code = 0; - m_Type = ""; - m_Message = ""; + fromPropertyTree(pt); } -ApiResponse::~ApiResponse() +std::string ApiResponse::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string ApiResponse::toJsonString(bool prettyJson) +void ApiResponse::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree ApiResponse::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void ApiResponse::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string ApiResponse::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void ApiResponse::fromJsonString(std::string const& jsonString) +void ApiResponse::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -54,7 +70,7 @@ void ApiResponse::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree ApiResponse::toPropertyTree() +ptree ApiResponse::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -64,7 +80,7 @@ ptree ApiResponse::toPropertyTree() return pt; } -void ApiResponse::fromPropertyTree(ptree const &pt) +void ApiResponse::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Code = pt.get("code", 0); @@ -76,6 +92,7 @@ int32_t ApiResponse::getCode() const { return m_Code; } + void ApiResponse::setCode(int32_t value) { m_Code = value; @@ -84,6 +101,7 @@ std::string ApiResponse::getType() const { return m_Type; } + void ApiResponse::setType(std::string value) { m_Type = value; @@ -92,11 +110,26 @@ std::string ApiResponse::getMessage() const { return m_Message; } + void ApiResponse::setMessage(std::string value) { m_Message = value; } +std::vector createApiResponseVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(ApiResponse(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/ApiResponse.h b/samples/server/petstore/cpp-restbed/model/ApiResponse.h index 0f90e52c313..b67b10af78d 100644 --- a/samples/server/petstore/cpp-restbed/model/ApiResponse.h +++ b/samples/server/petstore/cpp-restbed/model/ApiResponse.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -23,6 +23,7 @@ #include #include +#include #include namespace org { @@ -36,8 +37,9 @@ namespace model { class ApiResponse { public: - ApiResponse(); - virtual ~ApiResponse(); + ApiResponse() = default; + explicit ApiResponse(boost::property_tree::ptree const& pt); + virtual ~ApiResponse() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -64,12 +66,26 @@ public: /// std::string getMessage() const; void setMessage(std::string value); + protected: - int32_t m_Code; - std::string m_Type; - std::string m_Message; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int32_t m_Code = 0; + std::string m_Type = ""; + std::string m_Message = ""; }; +std::vector createApiResponseVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Category.cpp b/samples/server/petstore/cpp-restbed/model/Category.cpp index 253eeceeaf8..d5bf918f62d 100644 --- a/samples/server/petstore/cpp-restbed/model/Category.cpp +++ b/samples/server/petstore/cpp-restbed/model/Category.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "Category.h" #include +#include #include +#include #include #include @@ -28,24 +30,39 @@ namespace openapitools { namespace server { namespace model { -Category::Category() +Category::Category(boost::property_tree::ptree const& pt) { - m_Id = 0L; - m_Name = ""; + fromPropertyTree(pt); } -Category::~Category() +std::string Category::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string Category::toJsonString(bool prettyJson) +void Category::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree Category::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void Category::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string Category::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void Category::fromJsonString(std::string const& jsonString) +void Category::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -53,7 +70,7 @@ void Category::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree Category::toPropertyTree() +ptree Category::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -62,7 +79,7 @@ ptree Category::toPropertyTree() return pt; } -void Category::fromPropertyTree(ptree const &pt) +void Category::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); @@ -73,6 +90,7 @@ int64_t Category::getId() const { return m_Id; } + void Category::setId(int64_t value) { m_Id = value; @@ -81,11 +99,26 @@ std::string Category::getName() const { return m_Name; } + void Category::setName(std::string value) { m_Name = value; } +std::vector createCategoryVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(Category(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Category.h b/samples/server/petstore/cpp-restbed/model/Category.h index 13cd4416ce1..949677e8bf7 100644 --- a/samples/server/petstore/cpp-restbed/model/Category.h +++ b/samples/server/petstore/cpp-restbed/model/Category.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -23,6 +23,7 @@ #include #include +#include #include namespace org { @@ -36,8 +37,9 @@ namespace model { class Category { public: - Category(); - virtual ~Category(); + Category() = default; + explicit Category(boost::property_tree::ptree const& pt); + virtual ~Category() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -58,11 +60,25 @@ public: /// std::string getName() const; void setName(std::string value); + protected: - int64_t m_Id; - std::string m_Name; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int64_t m_Id = 0L; + std::string m_Name = ""; }; +std::vector createCategoryVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Order.cpp b/samples/server/petstore/cpp-restbed/model/Order.cpp index 19e539ce226..b0e1db2687e 100644 --- a/samples/server/petstore/cpp-restbed/model/Order.cpp +++ b/samples/server/petstore/cpp-restbed/model/Order.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "Order.h" #include +#include #include +#include #include #include #include @@ -29,29 +31,39 @@ namespace openapitools { namespace server { namespace model { -Order::Order() +Order::Order(boost::property_tree::ptree const& pt) { - m_Id = 0L; - m_PetId = 0L; - m_Quantity = 0; - m_ShipDate = ""; - m_Status = ""; - m_StatusEnum = { "placed", "approved", "delivered" }; - m_Complete = false; + fromPropertyTree(pt); } -Order::~Order() +std::string Order::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string Order::toJsonString(bool prettyJson) +void Order::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree Order::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void Order::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string Order::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void Order::fromJsonString(std::string const& jsonString) +void Order::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -59,7 +71,7 @@ void Order::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree Order::toPropertyTree() +ptree Order::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -72,7 +84,7 @@ ptree Order::toPropertyTree() return pt; } -void Order::fromPropertyTree(ptree const &pt) +void Order::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); @@ -87,6 +99,7 @@ int64_t Order::getId() const { return m_Id; } + void Order::setId(int64_t value) { m_Id = value; @@ -95,6 +108,7 @@ int64_t Order::getPetId() const { return m_PetId; } + void Order::setPetId(int64_t value) { m_PetId = value; @@ -103,6 +117,7 @@ int32_t Order::getQuantity() const { return m_Quantity; } + void Order::setQuantity(int32_t value) { m_Quantity = value; @@ -111,6 +126,7 @@ std::string Order::getShipDate() const { return m_ShipDate; } + void Order::setShipDate(std::string value) { m_ShipDate = value; @@ -119,6 +135,7 @@ std::string Order::getStatus() const { return m_Status; } + void Order::setStatus(std::string value) { if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) { @@ -131,11 +148,26 @@ bool Order::isComplete() const { return m_Complete; } + void Order::setComplete(bool value) { m_Complete = value; } +std::vector createOrderVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(Order(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Order.h b/samples/server/petstore/cpp-restbed/model/Order.h index 8e916ba2683..b10f2daf3ac 100644 --- a/samples/server/petstore/cpp-restbed/model/Order.h +++ b/samples/server/petstore/cpp-restbed/model/Order.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include namespace org { @@ -37,8 +39,9 @@ namespace model { class Order { public: - Order(); - virtual ~Order(); + Order() = default; + explicit Order(boost::property_tree::ptree const& pt); + virtual ~Order() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -83,16 +86,33 @@ public: /// bool isComplete() const; void setComplete(bool value); + protected: - int64_t m_Id; - int64_t m_PetId; - int32_t m_Quantity; - std::string m_ShipDate; - std::string m_Status; - bool m_Complete; - std::vector m_StatusEnum; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int64_t m_Id = 0L; + int64_t m_PetId = 0L; + int32_t m_Quantity = 0; + std::string m_ShipDate = ""; + std::string m_Status = ""; + bool m_Complete = false; + const std::array m_StatusEnum = { + "placed","approved","delivered" + }; + }; +std::vector createOrderVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Pet.cpp b/samples/server/petstore/cpp-restbed/model/Pet.cpp index 3e0d909847d..b9392b60f53 100644 --- a/samples/server/petstore/cpp-restbed/model/Pet.cpp +++ b/samples/server/petstore/cpp-restbed/model/Pet.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "Pet.h" #include +#include #include +#include #include #include #include @@ -29,26 +31,39 @@ namespace openapitools { namespace server { namespace model { -Pet::Pet() +Pet::Pet(boost::property_tree::ptree const& pt) { - m_Id = 0L; - m_Name = ""; - m_Status = ""; - m_StatusEnum = { "available", "pending", "sold" }; + fromPropertyTree(pt); } -Pet::~Pet() +std::string Pet::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string Pet::toJsonString(bool prettyJson) +void Pet::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree Pet::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void Pet::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string Pet::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void Pet::fromJsonString(std::string const& jsonString) +void Pet::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -56,7 +71,7 @@ void Pet::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree Pet::toPropertyTree() +ptree Pet::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -68,9 +83,9 @@ ptree Pet::toPropertyTree() // generate tree for PhotoUrls if (!m_PhotoUrls.empty()) { for (const auto &childEntry : m_PhotoUrls) { - ptree PhotoUrls_node; - PhotoUrls_node.put("", childEntry); - tmp_node.push_back(std::make_pair("", PhotoUrls_node)); + ptree PhotoUrls_node; + PhotoUrls_node.put("", childEntry); + tmp_node.push_back(std::make_pair("", PhotoUrls_node)); } pt.add_child("photoUrls", tmp_node); tmp_node.clear(); @@ -78,9 +93,7 @@ ptree Pet::toPropertyTree() // generate tree for Tags if (!m_Tags.empty()) { for (const auto &childEntry : m_Tags) { - ptree Tags_node; - Tags_node.put("", childEntry); - tmp_node.push_back(std::make_pair("", Tags_node)); + tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree())); } pt.add_child("tags", tmp_node); tmp_node.clear(); @@ -89,7 +102,7 @@ ptree Pet::toPropertyTree() return pt; } -void Pet::fromPropertyTree(ptree const &pt) +void Pet::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); @@ -101,13 +114,17 @@ void Pet::fromPropertyTree(ptree const &pt) // push all items of PhotoUrls into member vector if (pt.get_child_optional("photoUrls")) { for (const auto &childTree : pt.get_child("photoUrls")) { - m_PhotoUrls.emplace_back(childTree.second.data()); + std::string val = + childTree.second.data(); + m_PhotoUrls.emplace_back(std::move(val)); } } // push all items of Tags into member vector if (pt.get_child_optional("tags")) { for (const auto &childTree : pt.get_child("tags")) { - m_Tags.emplace_back(childTree.second.data()); + std::shared_ptr val = + std::make_shared(childTree.second); + m_Tags.emplace_back(std::move(val)); } } setStatus(pt.get("status", "")); @@ -117,6 +134,7 @@ int64_t Pet::getId() const { return m_Id; } + void Pet::setId(int64_t value) { m_Id = value; @@ -125,6 +143,7 @@ std::shared_ptr Pet::getCategory() const { return m_Category; } + void Pet::setCategory(std::shared_ptr value) { m_Category = value; @@ -133,6 +152,7 @@ std::string Pet::getName() const { return m_Name; } + void Pet::setName(std::string value) { m_Name = value; @@ -141,6 +161,7 @@ std::vector Pet::getPhotoUrls() const { return m_PhotoUrls; } + void Pet::setPhotoUrls(std::vector value) { m_PhotoUrls = value; @@ -149,6 +170,7 @@ std::vector> Pet::getTags() const { return m_Tags; } + void Pet::setTags(std::vector> value) { m_Tags = value; @@ -157,6 +179,7 @@ std::string Pet::getStatus() const { return m_Status; } + void Pet::setStatus(std::string value) { if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) { @@ -166,6 +189,20 @@ void Pet::setStatus(std::string value) } } +std::vector createPetVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(Pet(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Pet.h b/samples/server/petstore/cpp-restbed/model/Pet.h index b7a59c60851..43bd89e15be 100644 --- a/samples/server/petstore/cpp-restbed/model/Pet.h +++ b/samples/server/petstore/cpp-restbed/model/Pet.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -26,6 +26,8 @@ #include "Category.h" #include #include +#include +#include #include namespace org { @@ -39,8 +41,9 @@ namespace model { class Pet { public: - Pet(); - virtual ~Pet(); + Pet() = default; + explicit Pet(boost::property_tree::ptree const& pt); + virtual ~Pet() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -85,16 +88,33 @@ public: /// std::string getStatus() const; void setStatus(std::string value); + protected: - int64_t m_Id; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int64_t m_Id = 0L; std::shared_ptr m_Category; - std::string m_Name; + std::string m_Name = ""; std::vector m_PhotoUrls; std::vector> m_Tags; - std::string m_Status; - std::vector m_StatusEnum; + std::string m_Status = ""; + const std::array m_StatusEnum = { + "available","pending","sold" + }; + }; +std::vector createPetVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Tag.cpp b/samples/server/petstore/cpp-restbed/model/Tag.cpp index f4784b44059..3d191b7f3d3 100644 --- a/samples/server/petstore/cpp-restbed/model/Tag.cpp +++ b/samples/server/petstore/cpp-restbed/model/Tag.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "Tag.h" #include +#include #include +#include #include #include @@ -28,24 +30,39 @@ namespace openapitools { namespace server { namespace model { -Tag::Tag() +Tag::Tag(boost::property_tree::ptree const& pt) { - m_Id = 0L; - m_Name = ""; + fromPropertyTree(pt); } -Tag::~Tag() +std::string Tag::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string Tag::toJsonString(bool prettyJson) +void Tag::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree Tag::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void Tag::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string Tag::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void Tag::fromJsonString(std::string const& jsonString) +void Tag::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -53,7 +70,7 @@ void Tag::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree Tag::toPropertyTree() +ptree Tag::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -62,7 +79,7 @@ ptree Tag::toPropertyTree() return pt; } -void Tag::fromPropertyTree(ptree const &pt) +void Tag::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); @@ -73,6 +90,7 @@ int64_t Tag::getId() const { return m_Id; } + void Tag::setId(int64_t value) { m_Id = value; @@ -81,11 +99,26 @@ std::string Tag::getName() const { return m_Name; } + void Tag::setName(std::string value) { m_Name = value; } +std::vector createTagVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(Tag(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/Tag.h b/samples/server/petstore/cpp-restbed/model/Tag.h index b40aa2c7e15..82de314f729 100644 --- a/samples/server/petstore/cpp-restbed/model/Tag.h +++ b/samples/server/petstore/cpp-restbed/model/Tag.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -23,6 +23,7 @@ #include #include +#include #include namespace org { @@ -36,8 +37,9 @@ namespace model { class Tag { public: - Tag(); - virtual ~Tag(); + Tag() = default; + explicit Tag(boost::property_tree::ptree const& pt); + virtual ~Tag() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -58,11 +60,25 @@ public: /// std::string getName() const; void setName(std::string value); + protected: - int64_t m_Id; - std::string m_Name; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int64_t m_Id = 0L; + std::string m_Name = ""; }; +std::vector createTagVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/cpp-restbed/model/User.cpp b/samples/server/petstore/cpp-restbed/model/User.cpp index 65161d2fb27..bf913818196 100644 --- a/samples/server/petstore/cpp-restbed/model/User.cpp +++ b/samples/server/petstore/cpp-restbed/model/User.cpp @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -15,7 +15,9 @@ #include "User.h" #include +#include #include +#include #include #include @@ -28,30 +30,39 @@ namespace openapitools { namespace server { namespace model { -User::User() +User::User(boost::property_tree::ptree const& pt) { - m_Id = 0L; - m_Username = ""; - m_FirstName = ""; - m_LastName = ""; - m_Email = ""; - m_Password = ""; - m_Phone = ""; - m_UserStatus = 0; + fromPropertyTree(pt); } -User::~User() +std::string User::toJsonString(bool prettyJson /* = false */) { + return toJsonString_internal(prettyJson); } -std::string User::toJsonString(bool prettyJson) +void User::fromJsonString(std::string const& jsonString) +{ + fromJsonString_internal(jsonString); +} + +boost::property_tree::ptree User::toPropertyTree() +{ + return toPropertyTree_internal(); +} + +void User::fromPropertyTree(boost::property_tree::ptree const& pt) +{ + fromPropertyTree_internal(pt); +} + +std::string User::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } -void User::fromJsonString(std::string const& jsonString) +void User::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; @@ -59,7 +70,7 @@ void User::fromJsonString(std::string const& jsonString) this->fromPropertyTree(pt); } -ptree User::toPropertyTree() +ptree User::toPropertyTree_internal() { ptree pt; ptree tmp_node; @@ -74,7 +85,7 @@ ptree User::toPropertyTree() return pt; } -void User::fromPropertyTree(ptree const &pt) +void User::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); @@ -91,6 +102,7 @@ int64_t User::getId() const { return m_Id; } + void User::setId(int64_t value) { m_Id = value; @@ -99,6 +111,7 @@ std::string User::getUsername() const { return m_Username; } + void User::setUsername(std::string value) { m_Username = value; @@ -107,6 +120,7 @@ std::string User::getFirstName() const { return m_FirstName; } + void User::setFirstName(std::string value) { m_FirstName = value; @@ -115,6 +129,7 @@ std::string User::getLastName() const { return m_LastName; } + void User::setLastName(std::string value) { m_LastName = value; @@ -123,6 +138,7 @@ std::string User::getEmail() const { return m_Email; } + void User::setEmail(std::string value) { m_Email = value; @@ -131,6 +147,7 @@ std::string User::getPassword() const { return m_Password; } + void User::setPassword(std::string value) { m_Password = value; @@ -139,6 +156,7 @@ std::string User::getPhone() const { return m_Phone; } + void User::setPhone(std::string value) { m_Phone = value; @@ -147,11 +165,26 @@ int32_t User::getUserStatus() const { return m_UserStatus; } + void User::setUserStatus(int32_t value) { m_UserStatus = value; } +std::vector createUserVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(User(child.second)); + } + + return vec; +} + } } } diff --git a/samples/server/petstore/cpp-restbed/model/User.h b/samples/server/petstore/cpp-restbed/model/User.h index c785184e706..dcc3902dad0 100644 --- a/samples/server/petstore/cpp-restbed/model/User.h +++ b/samples/server/petstore/cpp-restbed/model/User.h @@ -5,7 +5,7 @@ * The version of the OpenAPI document: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator unset. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -23,6 +23,7 @@ #include #include +#include #include namespace org { @@ -36,8 +37,9 @@ namespace model { class User { public: - User(); - virtual ~User(); + User() = default; + explicit User(boost::property_tree::ptree const& pt); + virtual ~User() = default; std::string toJsonString(bool prettyJson = false); void fromJsonString(std::string const& jsonString); @@ -94,17 +96,31 @@ public: /// int32_t getUserStatus() const; void setUserStatus(int32_t value); + protected: - int64_t m_Id; - std::string m_Username; - std::string m_FirstName; - std::string m_LastName; - std::string m_Email; - std::string m_Password; - std::string m_Phone; - int32_t m_UserStatus; + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string toJsonString_internal(bool prettyJson = false); + virtual void fromJsonString_internal(std::string const& jsonString); + virtual boost::property_tree::ptree toPropertyTree_internal(); + virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt); + + +protected: + int64_t m_Id = 0L; + std::string m_Username = ""; + std::string m_FirstName = ""; + std::string m_LastName = ""; + std::string m_Email = ""; + std::string m_Password = ""; + std::string m_Phone = ""; + int32_t m_UserStatus = 0; }; +std::vector createUserVectorFromJsonString(const std::string& json); + } } } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/PkmstApplication.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/PkmstApplication.java index 63d2fac6ec5..0cbbacd2763 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/PkmstApplication.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/PkmstApplication.java @@ -16,8 +16,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @EnableSwagger2 -@EnableCircuitBreaker -@EnableHystrixDashboard public class PkmstApplication { private static final Logger LOGGER = LoggerFactory.getLogger(PkmstApplication.class); diff --git a/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml b/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml index 13ef356233c..63563acf2c4 100644 --- a/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml +++ b/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml @@ -20,14 +20,11 @@ info: name: Pkmst description: Microservice developed by PKMST version: 1.0.0 - -health: - hystrix: - enabled: true - + security: basic: enabled: false + # provide rabbitmq configuration spring: rabbitmq: diff --git a/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml b/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml index 57e184773b0..b54a29fc095 100644 --- a/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml +++ b/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml @@ -20,14 +20,11 @@ info: name: Pkmst description: Microservice developed by PKMST version: 1.0.0 - -health: - hystrix: - enabled: true - + security: basic: enabled: false + # provide rabbitmq configuration spring: rabbitmq: diff --git a/samples/server/petstore/php-slim4/README.md b/samples/server/petstore/php-slim4/README.md index b055cfb62bc..5dc80231b17 100644 --- a/samples/server/petstore/php-slim4/README.md +++ b/samples/server/petstore/php-slim4/README.md @@ -8,7 +8,7 @@ This server has been generated with [Slim PSR-7](https://github.com/slimphp/Slim ## Requirements * Web server with URL rewriting -* PHP 7.2 or newer +* PHP 7.3 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. diff --git a/samples/server/petstore/php-slim4/composer.json b/samples/server/petstore/php-slim4/composer.json index 085da3886de..da7b26a6d4f 100644 --- a/samples/server/petstore/php-slim4/composer.json +++ b/samples/server/petstore/php-slim4/composer.json @@ -8,7 +8,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.3 || ^8.0", "slim/slim": "^4.5.0", "dyorg/slim-token-authentication": "dev-slim4", "ybelenko/openapi-data-mocker": "^1.0", diff --git a/samples/server/petstore/php-slim4/config/dev/example.inc.php b/samples/server/petstore/php-slim4/config/dev/example.inc.php index bd0bff72774..9d461dca380 100644 --- a/samples/server/petstore/php-slim4/config/dev/example.inc.php +++ b/samples/server/petstore/php-slim4/config/dev/example.inc.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/config/prod/example.inc.php b/samples/server/petstore/php-slim4/config/prod/example.inc.php index bd0bff72774..9d461dca380 100644 --- a/samples/server/petstore/php-slim4/config/prod/example.inc.php +++ b/samples/server/petstore/php-slim4/config/prod/example.inc.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php b/samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php index a73ba0da845..3565cbc42c6 100644 --- a/samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php +++ b/samples/server/petstore/php-slim4/lib/Api/AbstractPetApi.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php b/samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php index 00d50340c81..af982bec785 100644 --- a/samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php +++ b/samples/server/petstore/php-slim4/lib/Api/AbstractStoreApi.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php b/samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php index 7b679c16c6d..ee99c33e8ae 100644 --- a/samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php +++ b/samples/server/petstore/php-slim4/lib/Api/AbstractUserApi.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Auth/AbstractAuthenticator.php b/samples/server/petstore/php-slim4/lib/Auth/AbstractAuthenticator.php index 33fbd4dfe44..42ea8a34d49 100644 --- a/samples/server/petstore/php-slim4/lib/Auth/AbstractAuthenticator.php +++ b/samples/server/petstore/php-slim4/lib/Auth/AbstractAuthenticator.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/BaseModel.php b/samples/server/petstore/php-slim4/lib/BaseModel.php index d33e7921de9..a8330177973 100644 --- a/samples/server/petstore/php-slim4/lib/BaseModel.php +++ b/samples/server/petstore/php-slim4/lib/BaseModel.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Middleware/JsonBodyParserMiddleware.php b/samples/server/petstore/php-slim4/lib/Middleware/JsonBodyParserMiddleware.php index e2811063d2f..993224f6c87 100644 --- a/samples/server/petstore/php-slim4/lib/Middleware/JsonBodyParserMiddleware.php +++ b/samples/server/petstore/php-slim4/lib/Middleware/JsonBodyParserMiddleware.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/ApiResponse.php b/samples/server/petstore/php-slim4/lib/Model/ApiResponse.php index eb197fa2dbf..6368eb2c726 100644 --- a/samples/server/petstore/php-slim4/lib/Model/ApiResponse.php +++ b/samples/server/petstore/php-slim4/lib/Model/ApiResponse.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/Category.php b/samples/server/petstore/php-slim4/lib/Model/Category.php index 7ee3e5a7186..8e1c6e1b653 100644 --- a/samples/server/petstore/php-slim4/lib/Model/Category.php +++ b/samples/server/petstore/php-slim4/lib/Model/Category.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/Order.php b/samples/server/petstore/php-slim4/lib/Model/Order.php index c6a4de073f0..52dfff78c0a 100644 --- a/samples/server/petstore/php-slim4/lib/Model/Order.php +++ b/samples/server/petstore/php-slim4/lib/Model/Order.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/Pet.php b/samples/server/petstore/php-slim4/lib/Model/Pet.php index bd138318fe3..c400e3208de 100644 --- a/samples/server/petstore/php-slim4/lib/Model/Pet.php +++ b/samples/server/petstore/php-slim4/lib/Model/Pet.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/Tag.php b/samples/server/petstore/php-slim4/lib/Model/Tag.php index 20f9f8f4213..4606b83ae88 100644 --- a/samples/server/petstore/php-slim4/lib/Model/Tag.php +++ b/samples/server/petstore/php-slim4/lib/Model/Tag.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/Model/User.php b/samples/server/petstore/php-slim4/lib/Model/User.php index 6cb015b3cd2..5fb9f025cd0 100644 --- a/samples/server/petstore/php-slim4/lib/Model/User.php +++ b/samples/server/petstore/php-slim4/lib/Model/User.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/lib/SlimRouter.php b/samples/server/petstore/php-slim4/lib/SlimRouter.php index be6c9ced338..fcc1a818d6c 100644 --- a/samples/server/petstore/php-slim4/lib/SlimRouter.php +++ b/samples/server/petstore/php-slim4/lib/SlimRouter.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/phpunit.xml.dist b/samples/server/petstore/php-slim4/phpunit.xml.dist index 1e245113f4b..d5f76a3c642 100644 --- a/samples/server/petstore/php-slim4/phpunit.xml.dist +++ b/samples/server/petstore/php-slim4/phpunit.xml.dist @@ -1,32 +1,22 @@ - - - - ./tests/Api - - - ./tests/BaseModelTest.php - ./tests/Model - - - - - ./lib/Api - ./lib/BaseModel.php - ./lib/Model - - - - - + + + + ./lib/Api + ./lib/BaseModel.php + ./lib/Model + + + + + ./tests/Api + + + ./tests/BaseModelTest.php + ./tests/Model + + + + + diff --git a/samples/server/petstore/php-slim4/public/index.php b/samples/server/petstore/php-slim4/public/index.php index 663ed396242..17511cbfb7a 100644 --- a/samples/server/petstore/php-slim4/public/index.php +++ b/samples/server/petstore/php-slim4/public/index.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/samples/server/petstore/php-slim4/tests/BaseModelTest.php b/samples/server/petstore/php-slim4/tests/BaseModelTest.php index 935b758b03c..49927e56871 100644 --- a/samples/server/petstore/php-slim4/tests/BaseModelTest.php +++ b/samples/server/petstore/php-slim4/tests/BaseModelTest.php @@ -2,7 +2,7 @@ /** * OpenAPI Petstore - * PHP version 7.2 + * PHP version 7.3 * * @package OpenAPIServer * @author OpenAPI Generator team diff --git a/website/src/dynamic/users.yml b/website/src/dynamic/users.yml index c8ff21541f9..5e114596222 100644 --- a/website/src/dynamic/users.yml +++ b/website/src/dynamic/users.yml @@ -143,6 +143,11 @@ image: "img/companies/edge_impulse.png" infoLink: "https://www.edgeimpulse.com/" pinned: false +- + caption: "Elastic Email" + image: "img/companies/elasticemail.png" + infoLink: "https://elasticemail.com/" + pinned: false - caption: "Element AI" image: "img/companies/element_ai.png" diff --git a/website/static/img/companies/elasticemail.png b/website/static/img/companies/elasticemail.png new file mode 100644 index 00000000000..69e0ae0b534 Binary files /dev/null and b/website/static/img/companies/elasticemail.png differ diff --git a/website/yarn.lock b/website/yarn.lock index ac004704c17..1dd6b0b5bd4 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -2206,7 +2206,7 @@ ccount@^1.0.3: resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.0.5.tgz#ac82a944905a65ce204eb03023157edf29425c17" integrity sha512-MOli1W+nfbPLlKEhInaxhRdp7KVLFxLN5ykwzHgLsLI3H3gs5jjFAK4Eoj3OzzcxCtumDaI8onoVDeQyWaNTkw== -chalk@2.4.2, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2226,15 +2226,6 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" - integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - chalk@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" @@ -2324,10 +2315,10 @@ chokidar@^3.3.0: optionalDependencies: fsevents "~2.1.2" -chownr@^1.1.1, chownr@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" - integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== +chownr@^1.1.1, chownr@^1.1.2, chownr@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== chrome-trace-event@^1.0.2: version "1.0.2" @@ -2458,9 +2449,9 @@ color-name@^1.0.0, color-name@~1.1.4: integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== color-string@^1.5.2: - version "1.5.3" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.3.tgz#c9bbc5f01b58b5492f3d6857459cb6590ce204cc" - integrity sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw== + version "1.6.0" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.6.0.tgz#c3915f61fe267672cb7e1e064c9d692219f6c312" + integrity sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA== dependencies: color-name "^1.0.0" simple-swizzle "^0.2.2" @@ -3902,7 +3893,7 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.5: +fs-minipass@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== @@ -5489,9 +5480,9 @@ lodash.uniq@4.5.0, lodash.uniq@^4.5.0: integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.5: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== loglevel@^1.6.6: version "1.6.6" @@ -5810,16 +5801,16 @@ minimatch@3.0.4, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= +minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + minipass-collect@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/minipass-collect/-/minipass-collect-1.0.2.tgz#22b813bf745dc6edba2576b940022ad6edc8c617" @@ -5841,7 +5832,7 @@ minipass-pipeline@^1.2.2: dependencies: minipass "^3.0.0" -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: +minipass@^2.6.0, minipass@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== @@ -5856,7 +5847,7 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" -minizlib@^1.2.1: +minizlib@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== @@ -5892,12 +5883,12 @@ mkdirp@0.3.0: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" integrity sha1-G79asbqCevI1dRQ0kEJkVfSB/h4= -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= +mkdirp@^0.5.1, mkdirp@^0.5.5, mkdirp@~0.5.1: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: - minimist "0.0.8" + minimist "^1.2.5" move-concurrently@^1.0.1: version "1.0.1" @@ -6581,9 +6572,9 @@ path-key@^3.0.0, path-key@^3.1.0: integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@0.1.7: version "0.1.7" @@ -7309,37 +7300,10 @@ postcss-values-parser@^2.0.0, postcss-values-parser@^2.0.1: indexes-of "^1.0.1" uniq "^1.0.1" -postcss@^7.0.0, postcss@^7.0.17, postcss@^7.0.5: - version "7.0.17" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" - integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== - dependencies: - chalk "^2.4.2" - source-map "^0.6.1" - supports-color "^6.1.0" - -postcss@^7.0.1: - version "7.0.7" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.7.tgz#2754d073f77acb4ef08f1235c36c5721a7201614" - integrity sha512-HThWSJEPkupqew2fnuQMEI2YcTj/8gMV3n80cMdJsKxfIh5tHf7nM5JigNX6LxVMqo6zkgQNAI88hyFvBk41Pg== - dependencies: - chalk "^2.4.1" - source-map "^0.6.1" - supports-color "^5.5.0" - -postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.2, postcss@^7.0.23, postcss@^7.0.6: - version "7.0.26" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.26.tgz#5ed615cfcab35ba9bbb82414a4fa88ea10429587" - integrity sha512-IY4oRjpXWYshuTDFxMVkJDtWIk2LhsTlu8bZnbEJA4+bYT16Lvpo8Qv6EvDumhYRgzjZl489pmsY3qVgJQ08nA== - dependencies: - chalk "^2.4.2" - source-map "^0.6.1" - supports-color "^6.1.0" - -postcss@^7.0.18: - version "7.0.18" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.18.tgz#4b9cda95ae6c069c67a4d933029eddd4838ac233" - integrity sha512-/7g1QXXgegpF+9GJj4iN7ChGF40sYuGYJ8WZu8DZWnmhQ/G36hfdk3q9LBJmoK+lZ+yzZ5KYpOoxq7LF1BxE8g== +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.18, postcss@^7.0.2, postcss@^7.0.23, postcss@^7.0.5, postcss@^7.0.6: + version "7.0.36" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.36.tgz#056f8cffa939662a8f5905950c07d5285644dfcb" + integrity sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw== dependencies: chalk "^2.4.2" source-map "^0.6.1" @@ -7515,10 +7479,10 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= -querystringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.0.tgz#7ded8dfbf7879dcc60d0a644ac6754b283ad17ef" - integrity sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg== +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: version "2.1.0" @@ -8115,15 +8079,15 @@ rxjs@^6.4.0: dependencies: tslib "^1.9.0" -safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.1.0, safe-buffer@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.1, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== safe-regex@^1.1.0: version "1.1.0" @@ -8758,7 +8722,7 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.3.0, supports-color@^5.5.0: +supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== @@ -8805,17 +8769,17 @@ tapable@^1.0.0, tapable@^1.1.3: integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== tar@^4: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + version "4.4.19" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" + integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" + chownr "^1.1.4" + fs-minipass "^1.2.7" + minipass "^2.9.0" + minizlib "^1.3.3" + mkdirp "^0.5.5" + safe-buffer "^5.2.1" + yallist "^3.1.1" terser-webpack-plugin@^1.4.3: version "1.4.3" @@ -9246,11 +9210,11 @@ urix@^0.1.0: integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= url-parse@^1.4.3: - version "1.4.4" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8" - integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg== + version "1.5.3" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862" + integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ== dependencies: - querystringify "^2.0.0" + querystringify "^2.1.1" requires-port "^1.0.0" url@^0.11.0: @@ -9616,9 +9580,9 @@ wrappy@1: integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= ws@^6.0.0, ws@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== + version "6.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" + integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw== dependencies: async-limiter "~1.0.0" @@ -9649,7 +9613,7 @@ xtend@^4.0.1, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==