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:
+ *
+ *