diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 85641dcbae5..b0ba09e394f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,7 @@ ### PR checklist - [ ] Read the [contribution guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md). -- [ ] Ran the shell/batch script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates) +- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`. - [ ] Filed the PR against the correct branch: master for non-breaking changes and `2.3.0` branch for breaking (non-backward compatible) changes. ### Description of the PR diff --git a/.travis.yml b/.travis.yml index c0a32a8b078..b1880348c76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_install: - export SW=`pwd` - rvm list - rvm use 2.2.5 - - gem environment + - gem environment - gem install bundler -N --no-ri --no-rdoc - gem install cocoapods -v 1.2.1 -N --no-ri --no-rdoc - gem install xcpretty -N --no-ri --no-rdoc @@ -108,4 +108,3 @@ after_success: mvn clean deploy --settings .travis/settings.xml; echo "Finished mvn clean deploy for 2.3.0"; fi; - diff --git a/README.md b/README.md index 564bc3cfc5d..74249ca6a21 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20 Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes -------------------------- | ------------ | -------------------------- | ----- 2.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.3.0-SNAPSHOT/)| Jul/Aug 2017 | 1.0, 1.1, 1.2, 2.0 | Minor release with breaking changes -2.2.3 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.2.3-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Patch release without breaking changes -[2.2.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.2) (**current stable**) | 2017-03-01 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.2) +[2.2.3](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.2) (**current stable**) | 2017-07-15 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.3) +[2.2.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.2) | 2017-03-01 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.2) [2.2.1](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.1) | 2016-08-07 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-codegen/tree/v2.2.1) [2.1.6](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.1.6) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6) 2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17) diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index d0211895700..cf9bb61db49 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -14,4 +14,5 @@ ./bin/java-petstore-retrofit2-play24.sh ./bin/java-petstore-jersey2-java6.sh ./bin/java-petstore-resttemplate.sh +./bin/java-petstore-resttemplate-withxml.sh ./bin/java-petstore-resteasy.sh diff --git a/bin/java-petstore-resttemplate-withxml.sh b/bin/java-petstore-resttemplate-withxml.sh index f38d5181417..75682a0ae16 100755 --- a/bin/java-petstore-resttemplate-withxml.sh +++ b/bin/java-petstore-resttemplate-withxml.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml --artifact-id swagger-pestore-resttemplate-withxml -l java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true" echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main" rm -rf samples/client/petstore/java/resttemplate-withXml/src/main diff --git a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java index 5d415dbf0f7..a73ed6aa0c0 100644 --- a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java +++ b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java @@ -20,6 +20,12 @@ import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiat import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvp; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvp; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyAdditionalPropertiesKvpList; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvpList; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvpList; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsvList; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvpList; +import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvpList; import static org.apache.commons.lang3.StringUtils.isNotEmpty; import java.io.File; @@ -178,9 +184,42 @@ public class CodeGenMojo extends AbstractMojo { @Parameter(name = "configOptions") private Map configOptions; + /** + * A map of types and the types they should be instantiated as + */ + @Parameter(name = "instantiationTypes") + private List instantiationTypes; + + /** + * A map of classes and the import that should be used for that class + */ @Parameter(name = "importMappings") private List importMappings; + /** + * A map of swagger spec types and the generated code types to use for them + */ + @Parameter(name = "typeMappings") + private List typeMappings; + + /** + * A map of additional language specific primitive types + */ + @Parameter(name = "languageSpecificPrimitives") + private List languageSpecificPrimitives; + + /** + * A map of additional properties that can be referenced by the mustache templates + */ + @Parameter(name = "additionalProperties") + private List additionalProperties; + + /** + * A map of reserved names and how they should be escaped + */ + @Parameter(name = "reservedWordsMappings") + private List reservedWordsMappings; + /** * Generate the apis */ @@ -390,42 +429,70 @@ public class CodeGenMojo extends AbstractMojo { System.setProperty("withXml", withXml.toString()); if (configOptions != null) { - - if (configOptions.containsKey("instantiation-types")) { + // Retained for backwards-compataibility with configOptions -> instantiation-types + if (instantiationTypes == null && configOptions.containsKey("instantiation-types")) { applyInstantiationTypesKvp(configOptions.get("instantiation-types").toString(), configurator); } + // Retained for backwards-compataibility with configOptions -> import-mappings if (importMappings == null && configOptions.containsKey("import-mappings")) { applyImportMappingsKvp(configOptions.get("import-mappings").toString(), configurator); } - if (configOptions.containsKey("type-mappings")) { + // Retained for backwards-compataibility with configOptions -> type-mappings + if (typeMappings == null && configOptions.containsKey("type-mappings")) { applyTypeMappingsKvp(configOptions.get("type-mappings").toString(), configurator); } - if (configOptions.containsKey("language-specific-primitives")) { + // Retained for backwards-compataibility with configOptions -> language-specific-primitives + if (languageSpecificPrimitives == null && configOptions.containsKey("language-specific-primitives")) { applyLanguageSpecificPrimitivesCsv(configOptions .get("language-specific-primitives").toString(), configurator); } - if (configOptions.containsKey("additional-properties")) { + // Retained for backwards-compataibility with configOptions -> additional-properties + if (additionalProperties == null && configOptions.containsKey("additional-properties")) { applyAdditionalPropertiesKvp(configOptions.get("additional-properties").toString(), configurator); } - if (configOptions.containsKey("reserved-words-mappings")) { + // Retained for backwards-compataibility with configOptions -> reserved-words-mappings + if (reservedWordsMappings == null && configOptions.containsKey("reserved-words-mappings")) { applyReservedWordsMappingsKvp(configOptions.get("reserved-words-mappings") .toString(), configurator); } } + //Apply Instantiation Types + if (instantiationTypes != null && !configOptions.containsKey("instantiation-types")) { + applyInstantiationTypesKvpList(instantiationTypes, configurator); + } + + //Apply Import Mappings if (importMappings != null && !configOptions.containsKey("import-mappings")) { - String importMappingsAsString = importMappings.toString(); - applyImportMappingsKvp( - importMappingsAsString.substring(0, importMappingsAsString.length() - 1), - configurator); + applyImportMappingsKvpList(importMappings, configurator); + } + + //Apply Type Mappings + if (typeMappings != null && !configOptions.containsKey("type-mappings")) { + applyTypeMappingsKvpList(typeMappings, configurator); + } + + //Apply Language Specific Primitives + if (languageSpecificPrimitives != null && !configOptions.containsKey("language-specific-primitives")) { + applyLanguageSpecificPrimitivesCsvList(languageSpecificPrimitives, configurator); + } + + //Apply Additional Properties + if (additionalProperties != null && !configOptions.containsKey("additional-properties")) { + applyAdditionalPropertiesKvpList(additionalProperties, configurator); + } + + //Apply Reserved Words Mappings + if (reservedWordsMappings != null && !configOptions.containsKey("reserved-words-mappings")) { + applyReservedWordsMappingsKvpList(reservedWordsMappings, configurator); } if (environmentVariables != null) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 97fe5af65c3..cf3fd691499 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -62,14 +62,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests")); cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception")); - supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); - supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.7"); - supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.22.2. JSON processing: Jackson 2.7.0"); - supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); + supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.8.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); + supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9"); + supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.9"); + supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead."); - supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.2.0. JSON processing: Gson 2.6.1 (Retrofit 2.0.2). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)"); - supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.7-RELEASE. JSON processing: Jackson 2.8.8"); - supportedLibraries.put("resteasy", "HTTP client: Resteasy client 3.0.19.Final. JSON processing: Jackson 2.7.0"); + supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.8.0. JSON processing: Gson 2.6.1 (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)"); + supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.8.9"); + supportedLibraries.put("resteasy", "HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.8.9"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); libraryOption.setEnum(supportedLibraries); diff --git a/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache index 6ceb8e8e8b0..209d310172b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache @@ -11,7 +11,7 @@ import com.google.gson.stream.JsonWriter; {{/gson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ {{#gson}} @JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) diff --git a/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache index 6df0dc6260c..e7ffa65d130 100644 --- a/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache @@ -1,5 +1,5 @@ /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ {{#gson}} @JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index 78a36f61a0d..d0a4c70f3a8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -80,7 +80,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{/isReadOnly}} /** {{#description}} - * {{{description}}} + * {{description}} {{/description}} {{^description}} * Get {{name}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache index 91f0495905b..05543a0dd0e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/pojo.mustache @@ -14,10 +14,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} + /** + {{#description}} + * {{description}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} **/ public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache index 1746a84649c..5e456c65740 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue; {{/jackson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache index 5946069d5ff..8f56eb4c601 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -33,7 +33,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}} /** {{#description}} - * {{{description}}} + * {{description}} {{/description}} {{^description}} * Get {{name}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumClass.mustache index c5c3143cb94..d98deed86cc 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumClass.mustache @@ -1,5 +1,5 @@ /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumOuterClass.mustache index 76c2cbf5a76..6de036b74eb 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumOuterClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/enumOuterClass.mustache @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/jackson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/modelEnum.mustache index baddbae19be..76ba2495d4b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/modelEnum.mustache @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/jackson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pojo.mustache index a88d0e5dbc2..69a60003102 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pojo.mustache @@ -63,9 +63,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{/isMapContainer}} {{/isReadOnly}} - /** + /** {{#description}} - * {{{description}}} + * {{description}} {{/description}} {{^description}} * Get {{name}} @@ -77,7 +77,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali * maximum: {{maximum}} {{/maximum}} * @return {{name}} - **/ + **/ {{#vendorExtensions.extraAnnotation}} {{{vendorExtensions.extraAnnotation}}} {{/vendorExtensions.extraAnnotation}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache index a9f78081ce5..618965cae5c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache @@ -1,5 +1,5 @@ /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache index 0138c2fc8ab..febff09ce6f 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/pojo.mustache @@ -11,10 +11,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} + /** + {{#description}} + * {{description}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} **/ {{#vendorExtensions.extraAnnotation}}{{{vendorExtensions.extraAnnotation}}}{{/vendorExtensions.extraAnnotation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache index a9f78081ce5..618965cae5c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache @@ -1,5 +1,5 @@ /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pojo.mustache index fdaf232510a..3b4bfd95464 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pojo.mustache @@ -11,10 +11,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} + /** + {{#description}} + * {{description}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} **/ {{#vendorExtensions.extraAnnotation}}{{{vendorExtensions.extraAnnotation}}}{{/vendorExtensions.extraAnnotation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache index 85de81431b6..29c83c9ac05 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue; {{/jackson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/pojo.mustache index 514a2957ffe..79ba3649d67 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/pojo.mustache @@ -11,10 +11,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} + /** + {{#description}} + * {{description}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} **/ public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; diff --git a/modules/swagger-codegen/src/main/resources/aspnetcore/model.mustache b/modules/swagger-codegen/src/main/resources/aspnetcore/model.mustache index 71d4ec434e9..4a876dd1600 100644 --- a/modules/swagger-codegen/src/main/resources/aspnetcore/model.mustache +++ b/modules/swagger-codegen/src/main/resources/aspnetcore/model.mustache @@ -21,9 +21,11 @@ namespace {{packageName}}.Models public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}> { {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{>enumClass}}{{/items}}{{/items.isEnum}} /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} {{#required}} [Required] {{/required}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index b11d14cdfc0..d8d5d4185dd 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -1,7 +1,9 @@ /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} [JsonConverter(typeof(StringEnumConverter))] {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache index b0dfa881eb2..64e50883f8d 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache @@ -1,7 +1,9 @@ /// - /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} [JsonConverter(typeof(StringEnumConverter))] {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 255984ded57..a05b84c3ee0 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -20,9 +20,11 @@ {{#vars}} {{#isEnum}} /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] public {{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} { get; set; } {{/isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache index d851a2dddc6..7af083a925f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache @@ -1,8 +1,10 @@ {{^isContainer}} /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} [JsonConverter(typeof(StringEnumConverter))] {{>visibility}} enum {{#datatypeWithEnum}}{{&.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/modelEnum.mustache index ddc5c2a56cf..8d29373d205 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/modelEnum.mustache @@ -1,7 +1,9 @@ /// - /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} + /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} diff --git a/pom.xml b/pom.xml index 61686f7096f..5504ecaab2d 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,11 @@ Tony Tam fehguy@gmail.com + + wing328 + William Cheng + wing328hk@gmail.com + github @@ -908,10 +913,10 @@ - 1.0.30 + 1.0.32 2.11.1 3.3.0 - 1.5.15 + 1.5.16 2.4 1.2 4.8.1 diff --git a/pom.xml.circleci b/pom.xml.circleci index 3c011550f25..99179a6d231 100644 --- a/pom.xml.circleci +++ b/pom.xml.circleci @@ -25,6 +25,11 @@ Tony Tam fehguy@gmail.com + + wing328 + William Cheng + wing328hk@gmail.com + github @@ -911,7 +916,7 @@ - 1.0.30 + 1.0.31 2.11.1 3.3.0 1.5.15 diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index f5e8e737d41..9a210422cb1 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -38,7 +38,7 @@ public class ModelReturn { } /** - * property description *_/ ' \" =end -- \\r\\n \\n \\r + * property description *_/ ' \" =end -- \\r\\n \\n \\r * @return _return **/ @ApiModelProperty(value = "property description *_/ ' \" =end -- \\r\\n \\n \\r") diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index 9777827cce5..d6b30494ce1 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -83,7 +83,7 @@ if(hasProperty('target') && target == 'android') { install { repositories.mavenInstaller { - pom.artifactId = 'swagger-petstore-resttemplate' + pom.artifactId = 'swagger-pestore-resttemplate-withxml' } } diff --git a/samples/client/petstore/java/resttemplate-withXml/pom.xml b/samples/client/petstore/java/resttemplate-withXml/pom.xml index d9a465e8264..8b13b2c4c93 100644 --- a/samples/client/petstore/java/resttemplate-withXml/pom.xml +++ b/samples/client/petstore/java/resttemplate-withXml/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 io.swagger - swagger-petstore-resttemplate + swagger-pestore-resttemplate-withxml jar - swagger-petstore-resttemplate + swagger-pestore-resttemplate-withxml 1.0.0 https://github.com/swagger-api/swagger-codegen Swagger Java diff --git a/samples/client/petstore/java/resttemplate-withXml/settings.gradle b/samples/client/petstore/java/resttemplate-withXml/settings.gradle index 09db544e8ba..47a3e512775 100644 --- a/samples/client/petstore/java/resttemplate-withXml/settings.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/settings.gradle @@ -1 +1 @@ -rootProject.name = "swagger-petstore-resttemplate" \ No newline at end of file +rootProject.name = "swagger-pestore-resttemplate-withxml" \ No newline at end of file diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index e459b17c168..0eb7db54a10 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 io.swagger - swagger-petstore-resttemplate-withxml + swagger-petstore-resttemplate jar - swagger-petstore-resttemplate-withxml + swagger-petstore-resttemplate 1.0.0 https://github.com/swagger-api/swagger-codegen Swagger Java diff --git a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION index 7fea99011a6..6b4d1577382 100644 --- a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION +++ b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3-SNAPSHOT \ No newline at end of file +2.2.3 \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index 61618433f8a..16b53e0bd1b 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -44,6 +44,10 @@ SWGPetApi::addPet(Pet body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -86,7 +90,13 @@ SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { - // TODO: add header support + if (api_key != nullptr) { + input.headers.insert("api_key", "api_key"); + } + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } connect(worker, &HttpRequestWorker::on_execution_finished, @@ -171,6 +181,10 @@ SWGPetApi::findPetsByStatus(QList* status) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -268,6 +282,10 @@ SWGPetApi::findPetsByTags(QList* tags) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -325,6 +343,10 @@ SWGPetApi::getPetById(qint64 pet_id) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -371,6 +393,10 @@ SWGPetApi::updatePet(Pet body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -420,6 +446,10 @@ SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -469,6 +499,10 @@ SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpReques + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index 13a18d2e78c..e1d4a455341 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -34,6 +34,7 @@ public: QString host; QString basePath; + QMap defaultHeaders; void addPet(Pet body); void deletePet(qint64 pet_id, QString* api_key); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index ceb964425aa..fa1ce8a1cc7 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -44,6 +44,10 @@ SWGStoreApi::deleteOrder(QString* order_id) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -85,6 +89,10 @@ SWGStoreApi::getInventory() { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -140,6 +148,10 @@ SWGStoreApi::getOrderById(qint64 order_id) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -186,6 +198,10 @@ SWGStoreApi::placeOrder(Order body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index d42fa5730b1..95be0fbc43c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -33,6 +33,7 @@ public: QString host; QString basePath; + QMap defaultHeaders; void deleteOrder(QString* order_id); void getInventory(); diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 35081b395b7..1da5a550490 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -44,6 +44,10 @@ SWGUserApi::createUser(User body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -92,6 +96,10 @@ SWGUserApi::createUsersWithArrayInput(QList* body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -140,6 +148,10 @@ SWGUserApi::createUsersWithListInput(QList* body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -183,6 +195,10 @@ SWGUserApi::deleteUser(QString* username) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -226,6 +242,10 @@ SWGUserApi::getUserByName(QString* username) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -286,6 +306,10 @@ SWGUserApi::loginUser(QString* username, QString* password) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -330,6 +354,10 @@ SWGUserApi::logoutUser() { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, @@ -375,6 +403,10 @@ SWGUserApi::updateUser(QString* username, User body) { + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + connect(worker, &HttpRequestWorker::on_execution_finished, this, diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.h b/samples/client/petstore/qt5cpp/client/SWGUserApi.h index 5b72570dae2..95a03959e9b 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.h @@ -33,6 +33,7 @@ public: QString host; QString basePath; + QMap defaultHeaders; void createUser(User body); void createUsersWithArrayInput(QList* body);