Merge remote-tracking branch 'origin/5.2.x' into 6.0.x

This commit is contained in:
William Cheng 2021-03-21 01:10:46 +08:00
commit 95d356ab6b
1255 changed files with 30792 additions and 3329 deletions

View File

@ -82,6 +82,7 @@ jobs:
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.pub-cache
- ~/.cache/bower
- ".git"
- ~/.stack

View File

@ -14,6 +14,18 @@ function cleanup {
trap cleanup EXIT
function installDart {
# install dart2
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin"
export DART_POST_PROCESS="dart format"
}
if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
java -version
@ -24,6 +36,8 @@ if [ "$NODE_INDEX" = "1" ]; then
ls -l /home/circleci/.ivy2/cache
elif [ "$NODE_INDEX" = "2" ]; then
installDart
# run ensure-up-to-date sample script on SNAPSHOT version only
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
if [[ $project_version == *"-SNAPSHOT" ]]; then
@ -67,14 +81,7 @@ else
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version
# install dart2
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin"
installDart
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error

View File

@ -9,7 +9,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.1.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.1.1`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
@ -18,6 +18,14 @@
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/openapitools/openapi-generator/Check%20Supported%20Java%20Versions/master?label=Check%20Supported%20Java%20Versions&logo=github&logoColor=green)](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
[5.2.x](https://github.com/OpenAPITools/openapi-generator/tree/5.2.x) (`5.2.x`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/5.2.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/5.2.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=5.2.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=5.2.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/5.2.x)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/5.2.x?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[6.0.x](https://github.com/OpenAPITools/openapi-generator/tree/6.0.x) (`6.0.x`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/6.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/6.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
@ -112,8 +120,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Nov/Dec 2021 | Minor release with breaking changes (no fallback) |
| 5.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.0-SNAPSHOT/) | Mar/Apr 2021 | Minor release with breaking changes (with fallback) |
| [5.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.0.1) (latest stable release) | 06.02.2021 | Patch release with enhancements, bug fixes, etc |
| 5.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | May/Jun 2021 | Minor release with breaking changes (with fallback) |
| 5.1.0 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.1-SNAPSHOT/) | Apr/May 2021 | Patch release (enhancements, bug fixes, etc) |
| [5.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.1.0) (latest stable release) | 20.03.2021 | Minor release with breaking changes (with fallback) |
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
@ -170,16 +179,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@ -404,7 +413,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 5.0.1
openapi-generator-cli version-manager set 5.1.0
```
Or install it as dev-dependency:
@ -428,7 +437,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
<!-- RELEASE_VERSION -->
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar)
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar)
<!-- /RELEASE_VERSION -->
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`

View File

@ -0,0 +1,7 @@
generatorName: jaxrs-cxf-cdi
outputDir: samples/server/petstore/jaxrs-cxf-cdi-default-value
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_8535.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi
additionalProperties:
hideGenerationTimestamp: "true"
artifactId: jaxrs-cxf-cdi-default-value

View File

@ -0,0 +1,7 @@
generatorName: jaxrs-resteasy
outputDir: samples/server/petstore/jaxrs-resteasy/default-value
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_8535.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy
additionalProperties:
hideGenerationTimestamp: "true"
artifactId: jaxrs-resteasy-default-value

View File

@ -0,0 +1,10 @@
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-retrofit2-kotlinx_serialization
library: jvm-retrofit2
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
serializationLibrary: kotlinx_serialization
artifactId: kotlin-petstore-retrofit2-kotlinx_serialization
enumPropertyNaming: UPPERCASE
serializableModel: "true"

View File

@ -0,0 +1,7 @@
generatorName: dart-dio-next
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_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/dart/libraries/dio
enablePostProcessFile: "true"
additionalProperties:
hideGenerationTimestamp: "true"

View File

@ -0,0 +1,11 @@
generatorName: kotlin
outputDir: samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2-kotlinx_serialization
library: jvm-retrofit2
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
serializationLibrary: kotlinx_serialization
useRxJava2: "true"
artifactId: kotlin-petstore-rx2-kotlinx_serialization-client
serializableModel: "true"
dateLibrary: java8

View File

@ -0,0 +1,7 @@
generatorName: spring
outputDir: samples/server/petstore/spring-mvc-default-value
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_8535.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
hideGenerationTimestamp: "true"
artifactId: spring-mvc-default-value

View File

@ -216,7 +216,7 @@ These options default to true and don't limit the generation of the feature opti
When using selective generation, _only_ the templates needed for the specific generation will be used.
To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to false) (this option is introduced at v3.2.2)
To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to `true`) (this option is introduced at v3.2.2 and `true` by default starting from v5.x).
```sh
--global-property skipFormModel=true

View File

@ -22,6 +22,7 @@ The following environment variables are supported by their respective generators
* `CPP_POST_PROCESS_FILE`
* `CSHARP_POST_PROCESS_FILE`
* `C_POST_PROCESS_FILE`
* `DART_POST_PROCESS`
* `DART_POST_PROCESS_FILE`
* `FSHARP_POST_PROCESS_FILE`
* `GO_POST_PROCESS_FILE`

View File

@ -22,6 +22,7 @@ The following generators are available:
* [csharp-netcore](generators/csharp-netcore.md)
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
* [dart-jaguar](generators/dart-jaguar.md)
* [eiffel](generators/eiffel.md)
* [elixir](generators/elixir.md)

View File

@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|operationResultTask|Set methods result to Task&lt;&gt;.| |false|
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|
|packageDescription|Specifies a AssemblyDescription for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |A library generated from a OpenAPI doc|
|packageGuid|The GUID that will be associated with the C# project| |null|
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|packageTitle|Specifies an AssemblyTitle for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |OpenAPI Library|

View File

@ -12,7 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|library|HTTP library template (sub-template) to use|<dl><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Beta support)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|library|HTTP library template (sub-template) to use|<dl><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Experimental. May subject to breaking changes without further notice.)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|licenseId|The identifier of the license| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|

View File

@ -0,0 +1,233 @@
---
title: Config Options for dart-dio-next
sidebar_label: dart-dio-next
---
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|dateLibrary|Specify Date library|<dl><dt>**core**</dt><dd>[DEFAULT] Dart core library (DateTime)</dd><dt>**timemachine**</dt><dd>Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.</dd></dl>|core|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|pubAuthor|Author name in generated pubspec| |null|
|pubAuthorEmail|Email address of the author in generated pubspec| |null|
|pubDescription|Description in generated pubspec| |null|
|pubHomepage|Homepage in generated pubspec| |null|
|pubLibrary|Library name in generated code| |null|
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|serializationLibrary|Specify serialization library|<dl><dt>**built_value**</dt><dd>[DEFAULT] built_value</dd></dl>|built_value|
|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|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>String</li>
<li>bool</li>
<li>double</li>
<li>dynamic</li>
<li>int</li>
<li>num</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>as</li>
<li>assert</li>
<li>async</li>
<li>await</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>covariant</li>
<li>default</li>
<li>deferred</li>
<li>do</li>
<li>dynamic</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>extension</li>
<li>external</li>
<li>factory</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>get</li>
<li>hide</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>in</li>
<li>inout</li>
<li>interface</li>
<li>is</li>
<li>late</li>
<li>library</li>
<li>mixin</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>of</li>
<li>on</li>
<li>operator</li>
<li>out</li>
<li>part</li>
<li>patch</li>
<li>required</li>
<li>rethrow</li>
<li>return</li>
<li>set</li>
<li>show</li>
<li>source</li>
<li>static</li>
<li>super</li>
<li>switch</li>
<li>sync</li>
<li>this</li>
<li>throw</li>
<li>true</li>
<li>try</li>
<li>typedef</li>
<li>var</li>
<li>void</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✗|OAS2,OAS3
|Int64|✗|OAS2,OAS3
|Float|✗|OAS2,OAS3
|Double|✗|OAS2,OAS3
|Decimal|✗|ToolingExtension
|String|✗|OAS2,OAS3
|Byte|✗|OAS2,OAS3
|Binary|✗|OAS2,OAS3
|Boolean|✗|OAS2,OAS3
|Date|✗|OAS2,OAS3
|DateTime|✗|OAS2,OAS3
|Password|✗|OAS2,OAS3
|File|✗|OAS2
|Array|✗|OAS2,OAS3
|Maps|✗|ToolingExtension
|CollectionFormat|✗|OAS2
|CollectionFormatMulti|✗|OAS2
|Enum|✗|OAS2,OAS3
|ArrayOfEnum|✗|ToolingExtension
|ArrayOfModel|✗|ToolingExtension
|ArrayOfCollectionOfPrimitives|✗|ToolingExtension
|ArrayOfCollectionOfModel|✗|ToolingExtension
|ArrayOfCollectionOfEnum|✗|ToolingExtension
|MapOfEnum|✗|ToolingExtension
|MapOfModel|✗|ToolingExtension
|MapOfCollectionOfPrimitives|✗|ToolingExtension
|MapOfCollectionOfModel|✗|ToolingExtension
|MapOfCollectionOfEnum|✗|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✗|ToolingExtension
|Api|✗|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✗|OAS2,OAS3
|BasePath|✗|OAS2,OAS3
|Info|✗|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✗|OAS2,OAS3
|Consumes|✗|OAS2
|Produces|✗|OAS2
|ExternalDocumentation|✗|OAS2,OAS3
|Examples|✗|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✗|OAS2,OAS3
|Query|✗|OAS2,OAS3
|Header|✗|OAS2,OAS3
|Body|✗|OAS2
|FormUnencoded|✗|OAS2
|FormMultipart|✗|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✗|OAS2,OAS3
|Composite|✗|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✗|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -135,8 +135,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations||ToolingExtension
|UserAgent||ToolingExtension
|Authorizations||ToolingExtension
|UserAgent||ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
@ -213,7 +213,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite||OAS2,OAS3
|Composite||OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
@ -223,7 +223,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken||OAS3
|BearerToken||OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
@ -233,6 +233,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML||OAS2,OAS3
|XML||OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -208,7 +208,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite||OAS2,OAS3
|Composite||OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
@ -228,6 +228,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML||OAS2,OAS3
|PROTOBUF||ToolingExtension
|XML||OAS2,OAS3
|PROTOBUF||ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -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|<dl><dt>**native_serialization**</dt><dd>Use native serializer, backwards compatible</dd><dt>**json_serializable**</dt><dd>Use json_serializable</dd></dl>|native_serialization|
|serializationLibrary|Specify serialization library|<dl><dt>**native_serialization**</dt><dd>Use native serializer, backwards compatible</dd><dt>**json_serializable**</dt><dd>Use json_serializable. Experimental and subject to breaking changes without further notice</dd></dl>|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|
@ -207,7 +207,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite||OAS2,OAS3
|Composite||OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
@ -217,7 +217,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken||OAS3
|BearerToken||OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
@ -227,6 +227,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML||OAS2,OAS3
|XML||OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -30,9 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>File</li>
<li>String</li>
<li>Vec&lt;u8&gt;</li>
<li>bool</li>
<li>char</li>
<li>f32</li>
@ -41,10 +39,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>i32</li>
<li>i64</li>
<li>i8</li>
<li>isize</li>
<li>str</li>
<li>u16</li>
<li>u32</li>
<li>u64</li>
<li>u8</li>
<li>usize</li>
</ul>
## RESERVED WORDS

View File

@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
To install a specific version of the tool, pass the version during installation:
<!-- RELEASE_VERSION -->
```bash
openapi-generator-cli version-manager set 5.0.1
openapi-generator-cli version-manager set 5.1.0
```
<!-- /RELEASE_VERSION -->
To install the tool as a dev dependency in your current project:
@ -80,18 +80,18 @@ docker run --rm \
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar`
For **Mac/Linux** users:
```bash
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```powershell
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar
```
<!-- /RELEASE_VERSION -->

View File

@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
[source,group]
----
plugins {
id "org.openapi.generator" version "5.0.1"
id "org.openapi.generator" version "5.1.0"
}
----
@ -113,7 +113,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:5.0.1"
classpath "org.openapitools:openapi-generator-gradle-plugin:5.1.0"
}
}

View File

@ -18,5 +18,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=5.0.1 openApiValidate
gradle -PopenApiGeneratorVersion=5.1.0 openApiValidate
```

View File

@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=5.1.0-SNAPSHOT
openApiGeneratorVersion=5.2.0-SNAPSHOT
# /RELEASE_VERSION

View File

@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.0.1</version>
<version>5.1.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.0.0-SNAPSHOT</version>
<version>6.0.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.0.0-SNAPSHOT</version>
<version>6.0.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@ -154,6 +154,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private CodegenProperty items;
private CodegenProperty additionalProperties;
private boolean isModel;
private boolean hasRequiredVars;
public String getAdditionalPropertiesType() {
return additionalPropertiesType;
@ -733,6 +734,16 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -114,6 +114,15 @@ public class CodegenOperation {
return nonempty(formParams);
}
/**
* Check if there's at least one body parameter or at least one form parameter
*
* @return true if body or form parameter exists, false otherwise
*/
public boolean getHasBodyOrFormParams() {
return getHasBodyParam() || getHasFormParams();
}
/**
* Check if there's at least one form parameter
*

View File

@ -104,6 +104,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
private Integer maxProperties;
private Integer minProperties;
public boolean isNull;
private boolean hasRequired;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@ -153,6 +154,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.isNull = this.isNull;
output.setAdditionalPropertiesIsAnyType(this.getAdditionalPropertiesIsAnyType());
output.setHasVars(this.hasVars);
output.setHasRequired(this.hasRequired);
if (this._enum != null) {
output._enum = new ArrayList<String>(this._enum);
@ -207,7 +209,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars);
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
@Override
@ -254,6 +256,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
isNull == that.isNull &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getUniqueItems() == that.getUniqueItems() &&
@ -372,6 +375,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", isNull=").append(isNull);
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append('}');
return sb.toString();
}
@ -619,5 +623,15 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public void setHasVars(boolean hasVars) {
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
}

View File

@ -187,6 +187,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isXmlWrapped = false;
private boolean additionalPropertiesIsAnyType;
private boolean hasVars;
private boolean hasRequired;
public String getBaseName() {
return baseName;
@ -715,6 +716,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@ -806,6 +817,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", isNull=").append(isNull);
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasVars=").append(getHasVars());
sb.append(", getHasRequired=").append(getHasRequired());
sb.append('}');
return sb.toString();
}
@ -857,6 +869,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isNull == that.isNull &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() ==that.getHasRequired() &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(complexType, that.complexType) &&
@ -918,6 +931,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
items, mostInnerItems, additionalProperties, vars, requiredVars,
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars);
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
}

View File

@ -81,6 +81,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private boolean hasValidation;
private boolean additionalPropertiesIsAnyType;
private boolean hasVars;
private boolean hasRequired;
@Override
public int hashCode() {
@ -91,7 +92,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
vars, requiredVars, isNull, hasValidation,
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars);
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
@Override
@ -135,6 +136,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
is5xx == that.is5xx &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
Objects.equals(vars, that.vars) &&
Objects.equals(requiredVars, that.requiredVars) &&
Objects.equals(headers, that.headers) &&
@ -371,6 +373,16 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
this.requiredVars = requiredVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenResponse{");
@ -435,6 +447,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", hasValidation='").append(hasValidation);
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append('}');
return sb.toString();
}

View File

@ -1829,6 +1829,20 @@ public class DefaultCodegen implements CodegenConfig {
return getPropertyDefaultValue(schema);
}
/**
* Return the default value of the parameter
*
* Return null if you do NOT want a default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param schema Parameter schema
* @return string presentation of the default value of the parameter
*/
public String toDefaultParameterValue(Schema<?> schema) {
// by default works as original method to be backward compatible
return toDefaultValue(schema);
}
/**
* Return property value depending on property type.
*
@ -2565,6 +2579,10 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (m.requiredVars != null && m.requiredVars.size() > 0){
m.setHasRequired(true);
}
if (sortModelPropertiesByRequiredFlag) {
Comparator<CodegenProperty> comparator = new Comparator<CodegenProperty>() {
@Override
@ -3103,7 +3121,14 @@ public class DefaultCodegen implements CodegenConfig {
property.title = p.getTitle();
property.getter = toGetter(name);
property.setter = toSetter(name);
property.example = toExampleValue(p);
// put toExampleValue in a try-catch block to log the error as example values are not critical
try {
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);
property.example = "ERROR_TO_EXAMPLE_VALUE";
}
property.defaultValue = toDefaultValue(p);
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
property.jsonSchema = Json.pretty(p);
@ -4198,7 +4223,7 @@ public class DefaultCodegen implements CodegenConfig {
}
// set default value
codegenParameter.defaultValue = toDefaultValue(parameterSchema);
codegenParameter.defaultValue = toDefaultParameterValue(parameterSchema);
if (parameter.getStyle() != null) {
codegenParameter.style = parameter.getStyle().toString();
@ -6149,6 +6174,9 @@ public class DefaultCodegen implements CodegenConfig {
.stream()
.filter(p -> Boolean.TRUE.equals(p.required)).collect(Collectors.toList());
property.setRequiredVars(requireCpVars);
if (property.getRequiredVars() != null && property.getRequiredVars().size() > 0) {
property.setHasRequired(true);
}
}
setAddProps(schema, property);
}

View File

@ -105,5 +105,9 @@ public interface IJsonSchemaValidationProperties {
boolean getHasVars();
void setHasVars(boolean hasVars);
void setHasVars(boolean hasRequiredVars);
boolean getHasRequired();
void setHasRequired(boolean hasRequired);
}

View File

@ -12,17 +12,16 @@ import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.openapitools.codegen.utils.StringUtils.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractDartCodegen extends DefaultCodegen {
@ -63,6 +62,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
.securityFeatures(EnumSet.of(
SecurityFeature.OAuth2_Implicit,
SecurityFeature.BasicAuth,
SecurityFeature.BearerToken,
SecurityFeature.ApiKey
))
.excludeGlobalFeatures(
@ -72,7 +72,9 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
GlobalFeature.ParameterStyling
)
.excludeSchemaSupportFeatures(
SchemaSupportFeature.Polymorphism
SchemaSupportFeature.Polymorphism,
SchemaSupportFeature.Union,
SchemaSupportFeature.Composite
)
.includeParameterFeatures(
ParameterFeature.Cookie
@ -80,6 +82,9 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
.includeClientModificationFeatures(
ClientModificationFeature.BasePath
)
.excludeWireFormatFeatures(
WireFormatFeature.XML
)
);
outputFolder = "generated-code/dart";
@ -657,6 +662,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
@Override
public void postProcessFile(File file, String fileType) {
super.postProcessFile(file, fileType);
if (file == null) {
return;
}
@ -668,7 +674,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// process all files with dart extension
if ("dart".equals(FilenameUtils.getExtension(file.toString()))) {
// currently only support "dartfmt -w yourcode.dart"
// currently supported is "dartfmt -w" and "dart format"
String command = dartPostProcessFile + " " + file.toString();
try {
Process p = Runtime.getRuntime().exec(command);
@ -683,4 +689,31 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
}
}
}
@Override
public void postProcess() {
if (isEnablePostProcessFile()) {
// Using the condition here to have way to still disable this
// for older Dart generators in CI by default.
// Post processing the whole dart output is much faster then individual files.
// Setting this variable to "dart format" is the suggested way of doing this.
final String dartPostProcess = System.getenv("DART_POST_PROCESS");
if (!StringUtils.isEmpty(dartPostProcess)) {
final String command = dartPostProcess + " " + getOutputDir();
try {
Process p = Runtime.getRuntime().exec(command);
int exitValue = p.waitFor();
if (exitValue != 0) {
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} else {
LOGGER.info("Successfully executed: {}", command);
}
} catch (Exception e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
}
}
}
super.postProcess();
}
}

View File

@ -23,10 +23,13 @@ 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.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.io.FilenameUtils;
@ -943,6 +946,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return super.toDefaultValue(schema);
}
@Override
public String toDefaultParameterValue(final Schema<?> schema) {
Object defaultValue = schema.getDefault();
if (defaultValue == null) {
return null;
}
// escape quotes
return defaultValue.toString().replace("\"", "\\\"");
}
/**
* Return the example value of the parameter. Overrides the
* setParameterExampleValue(CodegenParameter, Parameter) method in
@ -974,6 +987,49 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
setParameterExampleValue(codegenParameter);
}
/**
* Return the example value of the parameter. Overrides the parent method in DefaultCodegen
* to not set examples on complex models, as they don't compile properly.
*
* @param codegenParameter Codegen parameter
* @param requestBody Request body
*/
@Override
public void setParameterExampleValue(CodegenParameter codegenParameter, RequestBody requestBody) {
Boolean isModel = (codegenParameter.isModel || (codegenParameter.isContainer && codegenParameter.getItems().isModel));
Content content = requestBody.getContent();
if (content.size() > 1) {
// @see ModelUtils.getSchemaFromContent()
LOGGER.warn("Multiple MediaTypes found, using only the first one");
}
MediaType mediaType = content.values().iterator().next();
if (mediaType.getExample() != null) {
if (isModel) {
LOGGER.warn("Ignoring complex example on request body");
} else {
codegenParameter.example = mediaType.getExample().toString();
return;
}
}
if (mediaType.getExamples() != null && !mediaType.getExamples().isEmpty()) {
Example example = mediaType.getExamples().values().iterator().next();
if (example.getValue() != null) {
if (isModel) {
LOGGER.warn("Ignoring complex example on request body");
} else {
codegenParameter.example = example.getValue().toString();
return;
}
}
}
setParameterExampleValue(codegenParameter);
}
@Override
public void setParameterExampleValue(CodegenParameter p) {
String example;

View File

@ -44,7 +44,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'";
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson, jackson}
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson, jackson, kotlinx_serialization}
public static final String MODEL_MUTABLE = "modelMutable";
public static final String MODEL_MUTABLE_DESC = "Create mutable models";

View File

@ -148,6 +148,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
setSupportNullable(Boolean.TRUE);
// CLI options
addOption(CodegenConstants.PACKAGE_DESCRIPTION,
CodegenConstants.PACKAGE_DESCRIPTION_DESC,
packageDescription);
addOption(CodegenConstants.LICENSE_URL,
CodegenConstants.LICENSE_URL_DESC,
licenseUrl);

View File

@ -50,9 +50,6 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
public CLibcurlClientCodegen() {
super();
// TODO: c maintainer review
// Assumes that C community considers api/model header files as documentation.
// Generator supports Basic, OAuth, and API key explicitly. Bearer is excluded although clients are able to set headers directly.
modifyFeatureSet(features -> features
.includeDocumentationFeatures(
DocumentationFeature.Readme
@ -82,8 +79,8 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
modelTemplateFiles.put("model-body.mustache", ".c");
apiTemplateFiles.put("api-header.mustache", ".h");
apiTemplateFiles.put("api-body.mustache", ".c");
//modelDocTemplateFiles.put("model_doc.mustache", ".md");
//apiDocTemplateFiles.put("api_doc.mustache", ".md");
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
embeddedTemplateDir = templateDir = "C-libcurl";
// TODO add auto-generated test files

View File

@ -301,7 +301,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
regexModifiers.put('s', "Singleline");
regexModifiers.put('x', "IgnorePatternWhitespace");
supportedLibraries.put(HTTPCLIENT, "HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Beta support)");
supportedLibraries.put(HTTPCLIENT, "HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) "
+ "(Experimental. May subject to breaking changes without further notice.)");
supportedLibraries.put(RESTSHARP, "RestSharp (https://github.com/restsharp/RestSharp)");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "HTTP library template (sub-template) to use");

View File

@ -17,6 +17,7 @@
package org.openapitools.codegen.languages;
import com.google.common.collect.Sets;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.SupportingFile;
@ -37,14 +38,26 @@ public class DartClientCodegen extends AbstractDartCodegen {
public DartClientCodegen() {
super();
final CliOption serializationLibrary = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY,
additionalReservedWords.addAll(
Sets.newHashSet(
"StreamedRequest",
"ApiClient",
"QueryParam",
"Authentication",
"HttpBasicAuth",
"HttpBearerAuth",
"ApiKeyAuth",
"OAuth"
)
);
final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY,
"Specify serialization library");
serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE);
serializationLibrary.setType("String");
final Map<String, String> serializationOptions = new HashMap<>();
serializationOptions.put(SERIALIZATION_LIBRARY_NATIVE, "Use native serializer, backwards compatible");
serializationOptions.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "Use json_serializable");
serializationOptions.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "Use json_serializable. Experimental and subject to breaking changes without further notice");
serializationLibrary.setEnum(serializationOptions);
cliOptions.add(serializationLibrary);
}

View File

@ -22,6 +22,7 @@ import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.ClientModificationFeature;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.ProcessUtils;
import org.slf4j.Logger;
@ -46,6 +47,14 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
public DartDioClientCodegen() {
super();
modifyFeatureSet(features -> features
.includeClientModificationFeatures(
ClientModificationFeature.Authorizations,
ClientModificationFeature.UserAgent
)
);
outputFolder = "generated-code/dart-dio";
embeddedTemplateDir = "dart-dio";
this.setTemplateDir(embeddedTemplateDir);

View File

@ -0,0 +1,402 @@
/*
* Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import com.google.common.collect.Sets;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.ClientModificationFeature;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.ProcessUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.underscore;
public class DartDioNextClientCodegen extends AbstractDartCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(DartDioNextClientCodegen.class);
public static final String DATE_LIBRARY = "dateLibrary";
public static final String DATE_LIBRARY_CORE = "core";
public static final String DATE_LIBRARY_TIME_MACHINE = "timemachine";
public static final String DATE_LIBRARY_DEFAULT = DATE_LIBRARY_CORE;
public static final String SERIALIZATION_LIBRARY_BUILT_VALUE = "built_value";
public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE;
private static final String CLIENT_NAME = "clientName";
private String dateLibrary;
private String clientName;
public DartDioNextClientCodegen() {
super();
modifyFeatureSet(features -> features
.includeClientModificationFeatures(
ClientModificationFeature.Authorizations,
ClientModificationFeature.UserAgent
)
);
generatorMetadata = GeneratorMetadata.newBuilder()
.stability(Stability.EXPERIMENTAL)
.build();
outputFolder = "generated-code/dart-dio-next";
embeddedTemplateDir = "dart/libraries/dio";
this.setTemplateDir(embeddedTemplateDir);
apiPackage = "lib.src.api";
modelPackage = "lib.src.model";
supportedLibraries.put(SERIALIZATION_LIBRARY_BUILT_VALUE, "[DEFAULT] built_value");
final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library");
serializationLibrary.setEnum(supportedLibraries);
serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT);
cliOptions.add(serializationLibrary);
final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library");
dateOption.setDefault(DATE_LIBRARY_DEFAULT);
final Map<String, String> dateOptions = new HashMap<>();
dateOptions.put(DATE_LIBRARY_CORE, "[DEFAULT] Dart core library (DateTime)");
dateOptions.put(DATE_LIBRARY_TIME_MACHINE, "Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.");
dateOption.setEnum(dateOptions);
cliOptions.add(dateOption);
}
public String getDateLibrary() {
return dateLibrary;
}
public void setDateLibrary(String library) {
this.dateLibrary = library;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
@Override
public String getName() {
return "dart-dio-next";
}
@Override
public String getHelp() {
return "Generates a Dart Dio client library with null-safety.";
}
@Override
public void processOpts() {
super.processOpts();
if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) {
LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)");
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
}
if (!additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) {
additionalProperties.put(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DEFAULT);
LOGGER.debug("Serialization library not set, using default {}", SERIALIZATION_LIBRARY_DEFAULT);
}
setLibrary(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY).toString());
if (!additionalProperties.containsKey(DATE_LIBRARY)) {
additionalProperties.put(DATE_LIBRARY, DATE_LIBRARY_DEFAULT);
LOGGER.debug("Date library not set, using default {}", DATE_LIBRARY_DEFAULT);
}
setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString());
if (!additionalProperties.containsKey(CLIENT_NAME)) {
final String name = org.openapitools.codegen.utils.StringUtils.camelize(pubName);
additionalProperties.put(CLIENT_NAME, name);
LOGGER.debug("Client name not set, using default {}", DATE_LIBRARY_DEFAULT);
}
setClientName(additionalProperties.get(CLIENT_NAME).toString());
supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml"));
supportingFiles.add(new SupportingFile("analysis_options.mustache", "", "analysis_options.yaml"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
final String libFolder = sourceFolder + File.separator + "lib";
supportingFiles.add(new SupportingFile("lib.mustache", libFolder, pubName + ".dart"));
final String srcFolder = libFolder + File.separator + "src";
supportingFiles.add(new SupportingFile("api_client.mustache", srcFolder, "api.dart"));
supportingFiles.add(new SupportingFile("api_util.mustache", srcFolder, "api_util.dart"));
final String authFolder = srcFolder + File.separator + "auth";
supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart"));
supportingFiles.add(new SupportingFile("auth/basic_auth.mustache", authFolder, "basic_auth.dart"));
supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart"));
supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart"));
configureSerializationLibrary(srcFolder);
configureDateLibrary(srcFolder);
}
private void configureSerializationLibrary(String srcFolder) {
switch (library) {
default:
case SERIALIZATION_LIBRARY_BUILT_VALUE:
additionalProperties.put("useBuiltValue", "true");
configureSerializationLibraryBuiltValue(srcFolder);
break;
}
}
private void configureSerializationLibraryBuiltValue(String srcFolder) {
supportingFiles.add(new SupportingFile("serialization/built_value/serializers.mustache", srcFolder, "serializers.dart"));
typeMapping.put("Array", "BuiltList");
typeMapping.put("array", "BuiltList");
typeMapping.put("List", "BuiltList");
typeMapping.put("set", "BuiltSet");
typeMapping.put("map", "BuiltMap");
typeMapping.put("file", "Uint8List");
typeMapping.put("binary", "Uint8List");
typeMapping.put("object", "JsonObject");
typeMapping.put("AnyType", "JsonObject");
additionalReservedWords.addAll(Sets.newHashSet(
"EnumClass",
// The following are reserved dataTypes but can not be added to defaultIncludes
// as this would prevent them from being added to the imports.
"BuiltList",
"BuiltSet",
"BuiltMap",
"Uint8List",
"JsonObject"
));
importMapping.put("BuiltList", "package:built_collection/built_collection.dart");
importMapping.put("BuiltSet", "package:built_collection/built_collection.dart");
importMapping.put("BuiltMap", "package:built_collection/built_collection.dart");
importMapping.put("JsonObject", "package:built_value/json_object.dart");
importMapping.put("Uint8List", "dart:typed_data");
}
private void configureDateLibrary(String srcFolder) {
switch (dateLibrary) {
case DATE_LIBRARY_TIME_MACHINE:
additionalProperties.put("useDateLibTimeMachine", "true");
typeMapping.put("date", "OffsetDate");
typeMapping.put("Date", "OffsetDate");
typeMapping.put("DateTime", "OffsetDateTime");
typeMapping.put("datetime", "OffsetDateTime");
additionalReservedWords.addAll(Sets.newHashSet("OffsetDate", "OffsetDateTime"));
importMapping.put("OffsetDate", "package:time_machine/time_machine.dart");
importMapping.put("OffsetDateTime", "package:time_machine/time_machine.dart");
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
supportingFiles.add(new SupportingFile("serialization/built_value/local_date_serializer.mustache", srcFolder, "local_date_serializer.dart"));
}
break;
default:
case DATE_LIBRARY_CORE:
// this option uses the dart core classes
additionalProperties.put("useDateLibCore", "true");
break;
}
}
@Override
public String toDefaultValue(Schema schema) {
if (schema.getDefault() != null) {
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
if (ModelUtils.isArraySchema(schema)) {
if (ModelUtils.isSet(schema)) {
return "SetBuilder()";
}
return "ListBuilder()";
}
if (ModelUtils.isMapSchema(schema)) {
return "MapBuilder()";
}
}
if (ModelUtils.isDateSchema(schema) || ModelUtils.isDateTimeSchema(schema)) {
// this is currently not supported and would create compile errors
return null;
}
if (ModelUtils.isStringSchema(schema)) {
return "'" + schema.getDefault().toString().replaceAll("'", "\\'") + "'";
}
return schema.getDefault().toString();
}
return null;
}
@Override
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
objs = super.postProcessModels(objs);
List<Object> models = (List<Object>) objs.get("models");
ProcessUtils.addIndexToProperties(models, 1);
for (Object _mo : models) {
Map<String, Object> mo = (Map<String, Object>) _mo;
Set<String> modelImports = new HashSet<>();
CodegenModel cm = (CodegenModel) mo.get("model");
for (String modelImport : cm.imports) {
if (needToImport(modelImport)) {
if (importMapping().containsKey(modelImport)) {
modelImports.add(importMapping().get(modelImport));
} else {
modelImports.add("package:" + pubName + "/src/model/" + underscore(modelImport) + ".dart");
}
}
}
cm.imports = modelImports;
boolean hasVars = cm.vars.size() > 0;
cm.vendorExtensions.put("x-has-vars", hasVars);
}
return objs;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
if (property.isEnum) {
// enums are generated with built_value and make use of BuiltSet
model.imports.add("BuiltSet");
}
property.getVendorExtensions().put("x-built-value-serializer-type", createBuiltValueSerializerType(property));
}
}
private String createBuiltValueSerializerType(CodegenProperty property) {
final StringBuilder sb = new StringBuilder("const FullType(");
if (property.isContainer) {
appendBuiltValueCollection(sb, property);
} else {
sb.append(property.datatypeWithEnum);
}
sb.append(")");
return sb.toString();
}
private void appendBuiltValueCollection(StringBuilder sb, CodegenProperty property) {
sb.append(property.baseType);
sb.append(", [FullType(");
if (property.isMap) {
// a map always has string keys
sb.append("String), FullType(");
}
if (property.items.isContainer) {
appendBuiltValueCollection(sb, property.items);
} else {
sb.append(property.items.datatypeWithEnum);
}
sb.append(")]");
}
@Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
objs = super.postProcessOperationsWithModels(objs, allModels);
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
Set<Map<String, Object>> serializers = new HashSet<>();
Set<String> modelImports = new HashSet<>();
Set<String> fullImports = new HashSet<>();
for (CodegenOperation op : operationList) {
op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT);
boolean isJson = true; //default to JSON
boolean isForm = false;
boolean isMultipart = false;
if (op.consumes != null) {
for (Map<String, String> consume : op.consumes) {
if (consume.containsKey("mediaType")) {
String type = consume.get("mediaType");
isJson = type.equalsIgnoreCase("application/json");
isForm = type.equalsIgnoreCase("application/x-www-form-urlencoded");
isMultipart = type.equalsIgnoreCase("multipart/form-data");
break;
}
}
}
for (CodegenParameter param : op.bodyParams) {
if (param.baseType != null && param.baseType.equalsIgnoreCase("Uint8List") && isMultipart) {
param.baseType = "MultipartFile";
param.dataType = "MultipartFile";
}
if (param.isContainer) {
final Map<String, Object> serializer = new HashMap<>();
serializer.put("isArray", param.isArray);
serializer.put("uniqueItems", param.uniqueItems);
serializer.put("isMap", param.isMap);
serializer.put("baseType", param.baseType);
serializers.add(serializer);
}
}
op.vendorExtensions.put("x-is-json", isJson);
op.vendorExtensions.put("x-is-form", isForm);
op.vendorExtensions.put("x-is-multipart", isMultipart);
if (op.getHasFormParams()) {
fullImports.add("package:" + pubName + "/src/api_util.dart");
}
Set<String> imports = new HashSet<>();
for (String item : op.imports) {
if (needToImport(item)) {
if (importMapping().containsKey(item)) {
fullImports.add(importMapping().get(item));
} else {
imports.add(underscore(item));
}
}
}
modelImports.addAll(imports);
op.imports = imports;
if (op.returnContainer != null) {
final Map<String, Object> serializer = new HashMap<>();
serializer.put("isArray", Objects.equals("array", op.returnContainer) || Objects.equals("set", op.returnContainer));
serializer.put("uniqueItems", op.uniqueItems);
serializer.put("isMap", Objects.equals("map", op.returnContainer));
serializer.put("baseType", op.returnBaseType);
serializers.add(serializer);
}
}
objs.put("modelImports", modelImports);
objs.put("fullImports", fullImports);
objs.put("serializers", serializers);
return objs;
}
}

View File

@ -17,6 +17,8 @@
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils;
@ -79,6 +81,10 @@ public class DartJaguarClientCodegen extends AbstractDartCodegen {
.includeParameterFeatures(
ParameterFeature.Cookie
)
.wireFormatFeatures(EnumSet.of(
WireFormatFeature.JSON,
WireFormatFeature.PROTOBUF
))
.includeClientModificationFeatures(
ClientModificationFeature.BasePath
)

View File

@ -235,7 +235,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
this.useRxJava2 = useRxJava2;
}
public void setUseRxJava3(boolean useRxJava3) {
if (useRxJava3) {
this.useRxJava = false;
@ -379,7 +379,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
if(ProcessUtils.hasHttpBearerMethods(openAPI)) {
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.kt.mustache", authFolder, "HttpBearerAuth.kt"));
}
if(ProcessUtils.hasHttpBasicMethods(openAPI)) {
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.kt.mustache", authFolder, "HttpBasicAuth.kt"));
}
@ -476,6 +476,22 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
//supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
break;
case kotlinx_serialization:
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/AtomicBooleanAdapter.kt.mustache", infrastructureFolder, "AtomicBooleanAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/AtomicIntegerAdapter.kt.mustache", infrastructureFolder, "AtomicIntegerAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/AtomicLongAdapter.kt.mustache", infrastructureFolder, "AtomicLongAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/URIAdapter.kt.mustache", infrastructureFolder, "URIAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/URLAdapter.kt.mustache", infrastructureFolder, "URLAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigIntegerAdapter.kt.mustache", infrastructureFolder, "BigIntegerAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigDecimalAdapter.kt.mustache", infrastructureFolder, "BigDecimalAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/UUIDAdapter.kt.mustache", infrastructureFolder, "UUIDAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/StringBuilderAdapter.kt.mustache", infrastructureFolder, "StringBuilderAdapter.kt"));
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/proguard-rules.pro.mustache", "", "proguard-rules.pro"));
break;
}
}
@ -551,12 +567,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
supportingFiles.add(new SupportingFile("iosTest/Coroutine.kt.mustache", "src/iosTest/kotlin/util", "Coroutine.kt"));
supportingFiles.add(new SupportingFile("jsTest/Coroutine.kt.mustache", "src/jsTest/kotlin/util", "Coroutine.kt"));
supportingFiles.add(new SupportingFile("jvmTest/Coroutine.kt.mustache", "src/jvmTest/kotlin/util", "Coroutine.kt"));
// gradle wrapper supporting files
supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew"));
supportingFiles.add(new SupportingFile("gradlew.bat.mustache", "", "gradlew.bat"));
supportingFiles.add(new SupportingFile("gradle-wrapper.properties.mustache", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.properties"));
supportingFiles.add(new SupportingFile("gradle-wrapper.jar", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.jar"));
}
@ -571,6 +581,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle"));
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
// gradle wrapper supporting files
supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew"));
supportingFiles.add(new SupportingFile("gradlew.bat.mustache", "", "gradlew.bat"));
supportingFiles.add(new SupportingFile("gradle-wrapper.properties.mustache", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.properties"));
supportingFiles.add(new SupportingFile("gradle-wrapper.jar", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.jar"));
}
@Override

View File

@ -626,4 +626,17 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
}
}
}
@Override
public void postProcess() {
System.out.println("################################################################################");
System.out.println("# Thanks for using OpenAPI Generator. #");
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
System.out.println("# https://opencollective.com/openapi_generator/donate #");
System.out.println("# #");
System.out.println("# This generator is created by wing328 (https://github.com/wing328) #");
System.out.println("# Please support his work directly by purchasing a copy of the eBook \ud83d\udcd8 #");
System.out.println("# - OpenAPI Generator for Perl Developers https://bit.ly/2OId6p3 #");
System.out.println("################################################################################");
}
}

View File

@ -774,4 +774,18 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
example += ")";
return example;
}
@Override
public void postProcess() {
System.out.println("################################################################################");
System.out.println("# Thanks for using OpenAPI Generator. #");
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
System.out.println("# https://opencollective.com/openapi_generator/donate #");
System.out.println("# #");
System.out.println("# This generator has been refactored by wing328 (https://github.com/wing328) #");
System.out.println("# Please support his work directly by purchasing a copy of the eBook \ud83d\udcd8 #");
System.out.println("# - OpenAPI Generator for R Developers http://bit.ly/3lpywTG #");
System.out.println("################################################################################");
}
}

View File

@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@ -134,8 +133,8 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
Arrays.asList(
"i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64",
"f32", "f64",
"char", "bool", "String", "Vec<u8>", "File")
"f32", "f64", "isize", "usize",
"char", "bool", "str", "String")
);
instantiationTypes.clear();
@ -212,6 +211,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
allModels.put(modelName, cm);
}
}
for (Map.Entry<String, Object> entry : objs.entrySet()) {
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
@ -224,7 +224,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
Map<String, Object> mas = new HashMap<>();
mas.put("modelName", camelize(mappedModel.getModelName()));
mas.put("mappingName", mappedModel.getMappingName());
List<CodegenProperty> vars = model.getVars();
// TODO: deleting the variable from the array was
// problematic; I don't know what this is supposed to do
// so I'm just cloning it for the moment
List<CodegenProperty> vars = new ArrayList<>(model.getVars());
vars.removeIf(p -> p.name.equals(cm.discriminator.getPropertyName()));
mas.put("vars", vars);
discriminatorVars.add(mas);
@ -480,14 +484,10 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String getSchemaType(Schema p) {
String schemaType = super.getSchemaType(p);
String type = null;
if (typeMapping.containsKey(schemaType)) {
type = typeMapping.get(schemaType);
if (languageSpecificPrimitives.contains(type))
return (type);
} else
type = schemaType;
return type;
return typeMapping.get(schemaType);
}
return schemaType;
}
@Override
@ -637,7 +637,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
}
// string
String enumName = sanitizeName(camelize(name));
String enumName = camelize(sanitizeName(name));
enumName = enumName.replaceFirst("^_", "");
enumName = enumName.replaceFirst("_$", "");

View File

@ -999,13 +999,13 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
List<CodegenOperation> operations = (List<CodegenOperation>) objectMap.get("operation");
for (CodegenOperation operation : operations) {
for (CodegenParameter cp : operation.allParams) {
cp.vendorExtensions.put("x-swift-example", constructExampleCode(cp, modelMaps, new HashSet()));
cp.vendorExtensions.put("x-swift-example", constructExampleCode(cp, modelMaps, new HashSet<String>()));
}
}
return objs;
}
public String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, Set visitedModels) {
public String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, Set<String> visitedModels) {
if (codegenParameter.isArray) { // array
return "[" + constructExampleCode(codegenParameter.items, modelMaps, visitedModels) + "]";
} else if (codegenParameter.isMap) { // TODO: map, file type
@ -1037,11 +1037,11 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
} else { // model
// look up the model
if (modelMaps.containsKey(codegenParameter.dataType)) {
if (visitedModels.contains(modelMaps.get(codegenParameter.dataType))) {
if (visitedModels.contains(codegenParameter.dataType)) {
// recursive/self-referencing model, simply return nil to avoid stackoverflow
return "nil";
} else {
visitedModels.add(modelMaps.get(codegenParameter.dataType));
visitedModels.add(codegenParameter.dataType);
return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, visitedModels);
}
} else {
@ -1051,7 +1051,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
}
}
public String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, Set visitedModels) {
public String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, Set<String> visitedModels) {
if (codegenProperty.isArray) { // array
return "[" + constructExampleCode(codegenProperty.items, modelMaps, visitedModels) + "]";
} else if (codegenProperty.isMap) { // TODO: map, file type
@ -1083,10 +1083,11 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
} else {
// look up the model
if (modelMaps.containsKey(codegenProperty.dataType)) {
if (visitedModels.contains(modelMaps.get(codegenProperty.dataType))) {
if (visitedModels.contains(codegenProperty.dataType)) {
// recursive/self-referencing model, simply return nil to avoid stackoverflow
return "nil";
} else {
visitedModels.add(codegenProperty.dataType);
return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, visitedModels);
}
} else {
@ -1096,7 +1097,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
}
}
public String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, Set visitedModels) {
public String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, Set<String> visitedModels) {
String example;
example = codegenModel.name + "(";
List<String> propertyExamples = new ArrayList<>();

View File

@ -64,6 +64,55 @@ Once compiled, you can run it with ``` ./main ```
Note: You don't need to specify includes for models and include folder seperately as they are path linked. You just have to import the api.h file in your code, the include linking will work.
## Documentation for API Endpoints
All URIs are relative to *{{basePath}}*
Category | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{classname}}_{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{classname}}_{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation for Models
{{#models}}{{#model}} - [{{classname}}_t]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}
## Documentation for Authorization
{{^authMethods}}
All endpoints do not require authorization.
{{/authMethods}}
{{#authMethods}}
{{#last}}
Authentication schemes defined for the API:
{{/last}}
{{/authMethods}}
{{#authMethods}}
### {{name}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}
- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}
- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Author
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}

View File

@ -0,0 +1,60 @@
# {{classname}}{{#description}}
{{description}}{{/description}}
All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{classname}}_{{operationId}}**]({{classname}}.md#{{classname}}_{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
# **{{classname}}_{{{operationId}}}**
```c
{{#summary}}
// {{{summary}}}
//
{{/summary}}
{{#notes}}
// {{{notes}}}
//
{{/notes}}
{{#returnType}}{{#returnTypeIsPrimitive}}{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}{{^returnSimpleType}}{{#isArray}}{{{.}}}_t*{{/isArray}}{{#isMap}}{{{.}}}{{/isMap}}{{/returnSimpleType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{{.}}}_t*{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void{{/returnType}} {{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}}, {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{#isFreeFormObject}}{{dataType}}_t *{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isArray}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{/isArray}}{{#isContainer}}{{#isArray}}{{dataType}}_t *{{/isArray}}{{#isMap}}{{dataType}}{{/isMap}}{{/isContainer}} {{{paramName}}}{{/allParams}});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiClient** | **apiClient_t \*** | context containing the client configuration |
{{#allParams}}
**{{paramName}}** | {{#isPrimitiveType}}{{#isNumber}}**{{{dataType}}}**{{/isNumber}}{{#isLong}}**{{{dataType}}}**{{/isLong}}{{#isInteger}}**{{{dataType}}}**{{/isInteger}}{{#isDouble}}**{{{dataType}}}**{{/isDouble}}{{#isFloat}}**{{{dataType}}}**{{/isFloat}}{{#isBoolean}}**{{dataType}}**{{/isBoolean}}{{#isEnum}}{{#isString}}**{{projectName}}_{{operationId}}_{{baseName}}_e**{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}**{{{dataType}}} \***{{/isString}}{{/isEnum}}{{#isByteArray}}**{{{dataType}}}**{{/isByteArray}}{{#isDate}}**{{{dataType}}}**{{/isDate}}{{#isDateTime}}**{{{dataType}}}**{{/isDateTime}}{{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isFreeFormObject}}**[{{dataType}}_t]({{baseType}}.md) \***{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isArray}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}**{{datatypeWithEnum}}_e**{{/isEnum}}{{^isEnum}}**[{{{dataType}}}_t]({{{baseType}}}.md) \***{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}**{{datatypeWithEnum}}_e**{{/isEnum}}{{/isModel}}{{#isUuid}}**{{dataType}} \***{{/isUuid}}{{#isEmail}}**{{dataType}}**{{/isEmail}}{{/isPrimitiveType}}{{/isArray}}{{#isContainer}}{{#isArray}}**[{{dataType}}_t]({{baseType}}.md) \***{{/isArray}}{{#isMap}}**{{dataType}}**{{/isMap}}{{/isContainer}} | {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}}
### Return type
{{#returnType}}
{{#returnTypeIsPrimitive}}
{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}
{{^returnSimpleType}}
{{#isArray}}[{{{.}}}_t]({{returnBaseType}}.md) *{{/isArray}}
{{#isMap}}{{{.}}}{{/isMap}}
{{/returnSimpleType}}
{{/returnTypeIsPrimitive}}
{{^returnTypeIsPrimitive}}[{{{.}}}_t]({{returnBaseType}}.md) *{{/returnTypeIsPrimitive}}
{{/returnType}}
{{^returnType}}void{{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP request headers
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
{{/operation}}
{{/operations}}

View File

@ -0,0 +1,12 @@
{{#models}}{{#model}}# {{classname}}_t
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}
**{{name}}** | {{^isContainer}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}**{{projectName}}_{{classVarName}}_{{enumName}}_e**{{/isEnum}}{{^isEnum}}[**{{datatype}}_t**]({{complexType}}.md) \*{{/isEnum}}{{/isModel}}{{#isUuid}}**{{datatype}} \***{{/isUuid}}{{#isEmail}}**{{datatype}} \***{{/isEmail}}{{#isFreeFormObject}}[**{{datatype}}_t**]({{complexType}}.md) \*{{/isFreeFormObject}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isNumeric}}**{{datatype}}**{{/isNumeric}}{{#isBoolean}}**{{datatype}}**{{/isBoolean}}{{#isEnum}}{{#isString}}**{{projectName}}_{{classVarName}}_{{enumName}}_e**{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}**{{datatype}} \***{{/isString}}{{/isEnum}}{{#isByteArray}}**{{datatype}}**{{/isByteArray}}{{#isBinary}}**{{datatype}}**{{/isBinary}}{{#isDate}}**{{datatype}} \***{{/isDate}}{{#isDateTime}}**{{datatype}} \***{{/isDateTime}}{{/isPrimitiveType}}{{/isContainer}}{{#isContainer}}{{#isArray}}{{#isPrimitiveType}}**{{datatype}}_t \***{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}_t**]({{complexType}}.md) \*{{/isPrimitiveType}}{{/isArray}}{{#isMap}}**{{datatype}}**{{/isMap}}{{/isContainer}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{{/model}}{{/models}}

View File

@ -61,14 +61,15 @@ public class JSON {
{{/jsr310}}
private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
@SuppressWarnings("unchecked")
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder()
{{#models}}
{{#model}}
{{#discriminator}}
.registerTypeSelector({{classname}}.class, new TypeSelector() {
.registerTypeSelector({{classname}}.class, new TypeSelector<{{classname}}>() {
@Override
public Class getClassForElement(JsonElement readElement) {
public Class<? extends {{classname}}> getClassForElement(JsonElement readElement) {
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
{{#mappedModels}}
classByDiscriminatorValue.put("{{mappingName}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelName}}.class);

View File

@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}") {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -1011,10 +1011,10 @@ public class ApiClient {
public RequestBody serialize(Object obj, String contentType) throws ApiException {
if (obj instanceof byte[]) {
// Binary (byte array) body parameter support.
return RequestBody.create(MediaType.parse(contentType), (byte[]) obj);
return RequestBody.create((byte[]) obj, MediaType.parse(contentType));
} else if (obj instanceof File) {
// File body parameter support.
return RequestBody.create(MediaType.parse(contentType), (File) obj);
return RequestBody.create((File) obj, MediaType.parse(contentType));
} else if (isJsonMime(contentType)) {
String content;
if (obj != null) {
@ -1022,7 +1022,7 @@ public class ApiClient {
} else {
content = null;
}
return RequestBody.create(MediaType.parse(contentType), content);
return RequestBody.create(content, MediaType.parse(contentType));
} else {
throw new ApiException("Content type \"" + contentType + "\" is not supported");
}
@ -1272,7 +1272,7 @@ public class ApiClient {
reqBody = null;
} else {
// use an empty request body (for POST, PUT and PATCH)
reqBody = RequestBody.create(MediaType.parse(contentType), "");
reqBody = RequestBody.create("", MediaType.parse(contentType));
}
} else {
reqBody = serialize(body, contentType);
@ -1423,10 +1423,10 @@ public class ApiClient {
File file = (File) param.getValue();
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\"");
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file));
mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
} else {
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"");
mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue())));
mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null));
}
}
return mpBuilder.build();

View File

@ -47,7 +47,7 @@ public class OAuthOkHttpClient implements HttpClient {
}
}
RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null;
RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null;
requestBuilder.method(requestMethod, body);
try {

View File

@ -517,7 +517,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
} else if(MediaType.MULTIPART_FORM_DATA.equals(contentType)) {
return BodyInserters.fromMultipartData(formParams);
} else {
return obj != null ? BodyInserters.fromObject(obj) : null;
return obj != null ? BodyInserters.fromValue(obj) : null;
}
}
@ -573,7 +573,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
builder.queryParams(queryParams);
}
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.encode().toUriString(), pathParams);
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build(false).toUriString(), pathParams);
if(accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
}

View File

@ -124,7 +124,7 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.2"
spring_web_version = "5.0.16.RELEASE"
spring_web_version = "5.2.13.RELEASE"
jackson_version = "2.11.3"
jackson_databind_version = "2.11.3"
{{#openApiNullable}}

View File

@ -149,7 +149,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.2</swagger-annotations-version>
<spring-web-version>5.0.16.RELEASE</spring-web-version>
<spring-web-version>5.2.13.RELEASE</spring-web-version>
<jackson-version>2.11.3</jackson-version>
<jackson-databind-version>2.11.3</jackson-databind-version>
{{#openApiNullable}}

View File

@ -1 +1 @@
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{{defaultValue}}}{{/defaultValue}})@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) {{^isContainer}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}") {{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}") {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -1 +1 @@
{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}{{#useBeanValidation}}@Valid {{#required}}{{^isNullable}}@NotNull {{/isNullable}}{{/required}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}"){{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -4,25 +4,13 @@
}}{{#required}}, required = true{{/required}}{{!
}}{{^isContainer}}{{!
}}{{#allowableValues}}, {{> allowableValues}}{{/allowableValues}}{{!
}}{{#defaultValue}}, defaultValue = {{!
}}{{^isString}}"{{/isString}}{{!
}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{!
}}{{{defaultValue}}}{{!
}}{{^isString}}"{{/isString}}{{!
}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{!
}}{{/defaultValue}}{{!
}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}{{!
}}{{/isContainer}}{{!
}}){{!
}}{{^isContainer}}{{!
}}{{#defaultValue}}{{!
}} @DefaultValue({{!
}}{{^isString}}"{{/isString}}{{!
}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{!
}}{{{defaultValue}}}{{!
}}{{^isString}}"{{/isString}}{{!
}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{!
}}){{!
}} @DefaultValue("{{{defaultValue}}}"){{!
}}{{/defaultValue}}{{!
}}{{/isContainer}}{{!

View File

@ -1 +1 @@
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}}

View File

@ -1 +1 @@
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#useBeanValidation}}{{#required}} @NotNull{{/required}} @Valid{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isBodyParam}}

View File

@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{/isFormParam}}

View File

@ -1 +1 @@
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) @HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{/isFormParam}}

View File

@ -1 +1 @@
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) @HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} @ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}}{{/isContainer}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -1 +1 @@
{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}{{#useBeanValidation}}@Valid {{#required}}{{^isNullable}}@NotNull {{/isNullable}}{{/required}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}}

View File

@ -1 +1 @@
{{#isCookieParam}}@CookieParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isCookieParam}}
{{#isCookieParam}}@CookieParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isCookieParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -20,7 +20,9 @@ import org.springframework.http.ResponseEntity;
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
{{/useBeanValidation}}
{{#vendorExtensions.x-spring-paginated}}
import org.springframework.data.domain.Pageable;
{{/vendorExtensions.x-spring-paginated}}
import org.springframework.web.bind.annotation.*;
{{#jdk8-no-delegate}}
{{^reactive}}

View File

@ -25,7 +25,9 @@ import org.springframework.web.context.request.NativeWebRequest;
{{/isDelegate}}
{{^jdk8}}
import org.springframework.web.multipart.MultipartFile;
{{#vendorExtensions.x-spring-paginated}}
import org.springframework.data.domain.Pageable;
{{/vendorExtensions.x-spring-paginated}}
import springfox.documentation.annotations.ApiIgnore;
{{#useBeanValidation}}

View File

@ -3,7 +3,9 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import io.swagger.annotations.*;
{{#vendorExtensions.x-spring-paginated}}
import org.springframework.data.domain.Pageable;
{{/vendorExtensions.x-spring-paginated}}
{{#jdk8}}
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

View File

@ -1 +1 @@
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isBodyParam}}

View File

@ -1 +1 @@
{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @CookieValue("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isCookieParam}}
{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) @CookieValue("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isCookieParam}}

View File

@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{baseName}}{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{baseName}}{{/isFile}}{{/isFormParam}}

View File

@ -1 +1 @@
{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{>optionalDataType}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{>optionalDataType}} {{paramName}}{{/isHeaderParam}}

View File

@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") @RequestParam("{{baseName}}") {{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{paramName}}{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") @RequestParam("{{baseName}}") {{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{paramName}}{{/isFile}}{{/isFormParam}}

View File

@ -1 +1 @@
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}}

View File

@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}}

View File

@ -24,6 +24,7 @@ org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
org.openapitools.codegen.languages.CSharpNancyFXServerCodegen
org.openapitools.codegen.languages.DartClientCodegen
org.openapitools.codegen.languages.DartDioClientCodegen
org.openapitools.codegen.languages.DartDioNextClientCodegen
org.openapitools.codegen.languages.DartJaguarClientCodegen
org.openapitools.codegen.languages.EiffelClientCodegen
org.openapitools.codegen.languages.ElixirClientCodegen

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# 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
@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
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" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@ -5,11 +5,15 @@ project.version = '{{artifactVersion}}'
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
mavenLocal()
google()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.android.tools.build:gradle:3.2.+'
{{#useAndroidMavenGradlePlugin}}
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
{{/useAndroidMavenGradlePlugin}}
@ -18,6 +22,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
}
}
@ -30,7 +35,7 @@ apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
@ -51,14 +56,15 @@ android {
{{/java8}}
{{/supportJava6}}
}
lintOptions {
abortOnError false
}
// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
variant.outputs.all { output ->
if (outputFile != null && outputFileName.endsWith('.aar')) {
outputFileName = "${archivesBaseName}-${version}.aar"
}
}
}
@ -68,29 +74,24 @@ android {
}
}
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
httpmime_version = "4.5.2"
httpcore_version = "4.4.4"
httpclient_version = "4.3.3"
volley_version = "1.0.0"
junit_version = "4.13"
robolectric_version = "3.0"
concurrent_unit_version = "0.4.2"
swagger_annotations_version = "1.6.2"
gson_version = "2.8.6"
httpmime_version = "4.5.13"
volley_version = "1.2.0"
junit_version = "4.13.2"
robolectric_version = "4.5.1"
concurrent_unit_version = "0.4.6"
}
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpmime:$httpmime_version"
compile "org.apache.httpcomponents:httpclient-android:$httpclient_version"
compile "com.android.volley:volley:${volley_version}"
testCompile "junit:junit:$junit_version"
testCompile "org.robolectric:robolectric:${robolectric_version}"
testCompile "net.jodah:concurrentunit:${concurrent_unit_version}"
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
implementation "com.google.code.gson:gson:$gson_version"
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
implementation "com.android.volley:volley:${volley_version}"
testImplementation "junit:junit:$junit_version"
testImplementation "org.robolectric:robolectric:${robolectric_version}"
testImplementation "net.jodah:concurrentunit:${concurrent_unit_version}"
}
afterEvaluate {

View File

@ -17,16 +17,6 @@
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcomponents-httpcore-version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-android</artifactId>
<version>${httpcomponents-httpclient-version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
@ -63,9 +53,7 @@
</build>
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<httpcomponents-httpcore-version>4.4.4</httpcomponents-httpcore-version>
<httpcomponents-httpmime-version>4.5.2</httpcomponents-httpmime-version>
<httpcomponents-httpclient-version>4.3.3</httpcomponents-httpclient-version>
<google-code-gson-version>2.6.2</google-code-gson-version>
<volley-library-version>1.0.19</volley-library-version>
<android-platform-version>4.1.1.4</android-platform-version>

View File

@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Description>{{packageName}}</Description>
<Copyright>{{packageName}}</Copyright>
<Description>{{^packageDescription}}{{packageName}}{{/packageDescription}}{{packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
<Authors>{{packageAuthors}}</Authors>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Version>{{packageVersion}}</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

View File

@ -1,7 +1,8 @@
<Project Sdk="{{projectSdk}}">
<PropertyGroup>
<Description>{{packageName}}</Description>
<Copyright>{{packageName}}</Copyright>
<Description>{{^packageDescription}}{{packageName}}{{/packageDescription}}{{packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
<Authors>{{packageAuthors}}</Authors>
<TargetFramework>netcoreapp{{aspnetCoreVersion}}</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>

View File

@ -1,20 +1,20 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>{{packageVersion}}</version>
<title>{{packageTitle}}</title>
<authors>{{packageAuthors}}</authors>
<owners>{{packageAuthors}}</owners>
<licenseUrl>{{licenseUrl}}</licenseUrl>
<!--
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>{{packageName}}</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>{{packageCopyright}}</copyright>
<tags>{{packageName}}</tags>
</metadata>
<metadata>
<id>$id$</id>
<version>{{packageVersion}}</version>
<title>{{packageTitle}}</title>
<authors>{{packageAuthors}}</authors>
<owners>{{packageAuthors}}</owners>
<licenseUrl>{{licenseUrl}}</licenseUrl>
<!--
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>{{^packageDescription}}{{packageName}}{{/packageDescription}}{{packageDescription}}</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>{{packageCopyright}}</copyright>
<tags>{{packageName}}</tags>
</metadata>
</package>

View File

@ -1,7 +1,8 @@
<Project Sdk="{{projectSdk}}">
<PropertyGroup>
<Description>{{packageName}}</Description>
<Copyright>{{packageName}}</Copyright>
<Description>{{^packageDescription}}{{packageName}}{{/packageDescription}}{{packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
<Authors>{{packageAuthors}}</Authors>
<TargetFramework>{{targetFramework}}</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>

View File

@ -12,7 +12,7 @@
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>{{packageName}}</description>
<description>{{^packageDescription}}{{packageName}}{{/packageDescription}}{{packageDescription}}</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>{{packageCopyright}}</copyright>
<tags>{{packageName}}</tags>

View File

@ -1,6 +1,5 @@
{{>licenseInfo}}
#include "{{classname}}.h"
#include "{{prefix}}Helpers.h"
#include "{{prefix}}ServerConfiguration.h"
#include <QJsonArray>
#include <QJsonDocument>
@ -21,7 +20,6 @@ namespace {{this}} {
}
void {{classname}}::initializeServerConfigs(){
//Default server
QList<{{prefix}}ServerConfiguration> defaultConf = QList<{{prefix}}ServerConfiguration>();
//varying endpoint server
@ -38,8 +36,8 @@ void {{classname}}::initializeServerConfigs(){
{{#operations}}
{{#operation}}
{{^servers}}
_serverConfigs.insert("{{nickname}}",defaultConf);
_serverIndices.insert("{{nickname}}",0);
_serverConfigs.insert("{{nickname}}", defaultConf);
_serverIndices.insert("{{nickname}}", 0);
{{/servers}}
{{#servers}}
serverConf.append({{prefix}}ServerConfiguration(
@ -49,8 +47,8 @@ void {{classname}}::initializeServerConfigs(){
{"{{{name}}}", {{prefix}}ServerVariable("{{{description}}}{{^description}}No description provided{{/description}}","{{{defaultValue}}}",
QSet<QString>{ {{#enumValues}}{"{{{.}}}"}{{#-last}} })}, {{/-last}}{{^-last}},{{/-last}}{{/enumValues}}{{^enumValues}}{"{{defaultValue}}"} })},{{/enumValues}}{{#-last}} }));{{/-last}}
{{/variables}}{{^variables}}QMap<QString, {{prefix}}ServerVariable>()));{{/variables}}
{{#-last}}_serverConfigs.insert("{{nickname}}",serverConf);
_serverIndices.insert("{{nickname}}",0);{{/-last}}
{{#-last}}_serverConfigs.insert("{{nickname}}", serverConf);
_serverIndices.insert("{{nickname}}", 0);{{/-last}}
{{/servers}}
{{/operation}}
{{/operations}}
@ -224,7 +222,7 @@ QString {{classname}}::getParamStyleDelimiter(QString style, QString name, bool
{{#operations}}
{{#operation}}
void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const QVariant &{{/required}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {
void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const ::{{cppNamespace}}::OptionalParam<{{{dataType}}}> &{{/required}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {
QString fullPath = QString(_serverConfigs["{{nickname}}"][_serverIndices.value("{{nickname}}")].URL()+"{{{path}}}");
{{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}}
if(_apiKeys.contains("{{name}}")){
@ -247,9 +245,8 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
b64.append(_username.toUtf8() + ":" + _password.toUtf8());
addHeaders("Authorization","Basic " + b64.toBase64());
}{{/isBasicBasic}}{{/authMethods}}
{{#pathParams}}
{{^required}}if(!{{paramName}}.isNull()){{/required}}
{{^required}}if({{paramName}}.hasValue()){{/required}}
{
QString {{paramName}}PathParam("{");
{{paramName}}PathParam.append("{{baseName}}").append("}");
@ -263,7 +260,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
{{^collectionFormat}}
{{^isPrimitiveType}}
QString paramString = (pathStyle == "matrix" && {{isExplode}}) ? pathPrefix : pathPrefix+"{{baseName}}"+pathSuffix;
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
qint32 count = 0;
foreach(const QString& key, parameter.keys()) {
if (count > 0) {
@ -307,14 +304,14 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
{{/isPrimitiveType}}
{{#isPrimitiveType}}
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
fullPath.replace({{paramName}}PathParam, paramString+QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}})));
fullPath.replace({{paramName}}PathParam, paramString+QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}})));
{{/isPrimitiveType}}
{{/collectionFormat}}
{{#collectionFormat}}
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
{{/collectionFormat}}
{{#collectionFormat}}
if({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append(pathDelimiter);
}
@ -325,13 +322,12 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
}
{{/collectionFormat}}
}
{{/pathParams}}
{{#hasQueryParams}}
QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
{{/hasQueryParams}}
{{#queryParams}}
{{^required}}if(!{{paramName}}.isNull()){{/required}}
{{^required}}if({{paramName}}.hasValue()){{/required}}
{
queryStyle = "{{style}}";
if(queryStyle == "")
@ -346,7 +342,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
fullPath.append("?");
{{^isPrimitiveType}}
QString paramString = (queryStyle == "form" && {{isExplode}}) ? "" : (queryStyle == "form" && !({{isExplode}})) ? "{{baseName}}"+querySuffix : "";
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
qint32 count = 0;
foreach(const QString& key, parameter.keys()) {
if (count > 0) {
@ -392,13 +388,13 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
}
fullPath.append(paramString);
{{/isPrimitiveType}}{{#isPrimitiveType}}
fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}})));
{{/isPrimitiveType}}
{{/collectionFormat}}
{{#collectionFormat}}
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}})));
{{/isPrimitiveType}}
{{/collectionFormat}}
{{#collectionFormat}}
if({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
if (QString("{{collectionFormat}}").indexOf("multi") == 0) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (fullPath.indexOf("?") > 0)
fullPath.append(queryPrefix);
else
@ -411,7 +407,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
else
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append(({{isExplode}})? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
}
@ -424,7 +420,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
else
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append("\t");
}
@ -437,7 +433,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
else
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append(queryDelimiter);
}
@ -450,7 +446,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
else
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append(queryDelimiter);
}
@ -463,7 +459,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
else
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
fullPath.append(queryDelimiter);
}
@ -474,7 +470,6 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
}
{{/collectionFormat}}
}
{{/queryParams}}
{{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this, _manager);
worker->setTimeOut(_timeOut);
@ -493,39 +488,38 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
formSuffix = getParamStyleSuffix(formStyle);
formDelimiter = getParamStyleDelimiter(formStyle, "{{baseName}}", {{isExplode}});
{{/first}}
{{^required}}if(!{{paramName}}.isNull()){{/required}}
{{^required}}if({{paramName}}.hasValue()){{/required}}
{
{{^isFile}}
input.add_var("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
input.add_var("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}}));
{{/isFile}}
{{#isFile}}
input.add_file("{{baseName}}", {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.local_filename, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.request_filename, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.mime_type);
input.add_file("{{baseName}}", {{paramName}}{{^required}}.value(){{/required}}.local_filename, {{paramName}}{{^required}}.value(){{/required}}.request_filename, {{paramName}}{{^required}}.value(){{/required}}.mime_type);
{{/isFile}}
}
{{/formParams}}
{{#bodyParams}}
{{^required}}if({{paramName}}.hasValue()){{/required}}{
{{#isContainer}}
{{#isArray}}
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).toArray());{{/isArray}}{{#isMap}}
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).toObject());{{/isMap}}
QByteArray bytes = doc.toJson();
input.request_body.append(bytes);
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value(){{/required}}).toArray());{{/isArray}}{{#isMap}}
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value(){{/required}}).toObject());{{/isMap}}
QByteArray bytes = doc.toJson();
input.request_body.append(bytes);
{{/isContainer}}{{^isContainer}}{{#isString}}
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.toUtf8();{{/isString}}{{#isByteArray}}QByteArray output({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}}
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJson().toUtf8();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}}
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asByteArray();{{/isFile}}
input.request_body.append(output);
QByteArray output = {{paramName}}{{^required}}.value(){{/required}}.toUtf8();{{/isString}}{{#isByteArray}}QByteArray output({{paramName}}{{^required}}.value(){{/required}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}}
QByteArray output = {{paramName}}{{^required}}.value(){{/required}}.asJson().toUtf8();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}}
QByteArray output = {{paramName}}{{^required}}.value(){{/required}}.asByteArray();{{/isFile}}
input.request_body.append(output);
{{/isContainer}}
{{/bodyParams}}
}{{/bodyParams}}
{{#headerParams}}
{{^required}}if(!{{paramName}}.isNull()){{/required}}
{{^required}}if({{paramName}}.hasValue()){{/required}}
{
{{^collectionFormat}}
{{^isPrimitiveType}}
QString headerString;
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
qint32 count = 0;
foreach(const QString& key, parameter.keys()) {
if (count > 0) {
@ -567,34 +561,34 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
input.headers.insert("{{baseName}}", headerString);
{{/isPrimitiveType}}
{{#isPrimitiveType}}
if (!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).isEmpty()) {
input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
if (!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}}).isEmpty()) {
input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}}));
}
{{/isPrimitiveType}}{{/collectionFormat}}{{#collectionFormat}}
QString headerString;
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
if (count > 0) {
headerString.append(",");
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
headerString.append(",");
}
headerString.append(::{{cppNamespace}}::toStringValue(t));
count++;
}
headerString.append(::{{cppNamespace}}::toStringValue(t));
count++;
}
input.headers.insert("{{baseName}}", headerString);
input.headers.insert("{{baseName}}", headerString);
}
{{/collectionFormat}}
}
}
{{/headerParams}}
{{#cookieParams}}
{{^required}}if(!{{paramName}}.isNull()){{/required}}
{{^required}}if({{paramName}}.hasValue()){{/required}}
{
if(QString("{{style}}").indexOf("form") == 0){
{{^collectionFormat}}
{{^isPrimitiveType}}
{{^isExplode}}
QString cookieString = "{{baseName}}=";
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
qint32 count = 0;
foreach(const QString& key, parameter.keys()) {
if (count > 0) {
@ -636,8 +630,8 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
{{/isExplode}}
{{/isPrimitiveType}}
{{#isPrimitiveType}}
if (!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).isEmpty()) {
input.headers.insert("Cookie", "{{baseName}}="+::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
if(!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}}).isEmpty()) {
input.headers.insert("Cookie", "{{baseName}}="+::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value(){{/required}}));
}
{{/isPrimitiveType}}
{{/collectionFormat}}
@ -646,7 +640,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
QString cookieString = "{{baseName}}=";
if ({{{paramName}}}.size() > 0) {
qint32 count = 0;
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
if (count > 0) {
cookieString.append(",");
}
@ -664,7 +658,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, [this](){
if(findChildren<{{prefix}}HttpRequestWorker>().count() == 0){
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
emit allPendingRequestsCompleted();
}
});

View File

@ -2,6 +2,7 @@
#ifndef {{prefix}}_{{classname}}_H
#define {{prefix}}_{{classname}}_H
#include "{{prefix}}Helpers.h"
#include "{{prefix}}HttpRequest.h"
#include "{{prefix}}ServerConfiguration.h"
@ -13,7 +14,6 @@
#include <QStringList>
#include <QList>
#include <QNetworkAccessManager>
#include <QVariant>
{{#cppNamespaceDeclarations}}
namespace {{this}} {
@ -57,7 +57,7 @@ public:
{{/required}}
{{/allParams}}
*/{{/hasParams}}
{{#isDeprecated}}Q_DECL_DEPRECATED {{/isDeprecated}}void {{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const QVariant &{{/required}}{{paramName}}{{^required}} = QVariant(){{/required}}{{^-last}}, {{/-last}}{{/allParams}});
{{#isDeprecated}}Q_DECL_DEPRECATED {{/isDeprecated}}void {{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const ::{{cppNamespace}}::OptionalParam<{{{dataType}}}> &{{/required}}{{paramName}}{{^required}} = ::{{cppNamespace}}::OptionalParam<{{{dataType}}}>(){{/required}}{{^-last}}, {{/-last}}{{/allParams}});
{{/operation}}{{/operations}}
private:
@ -86,7 +86,7 @@ signals:
{{#operations}}{{#operation}}
void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str);{{/operation}}{{/operations}}
void abortRequestsSignal();
void abortRequestsSignal();
void allPendingRequestsCompleted();
};

View File

@ -11,7 +11,6 @@
#include <QList>
#include <QMap>
#include <QSet>
#include <QVariant>
#include "{{prefix}}Enum.h"
#include "{{prefix}}HttpFileElement.h"
@ -21,6 +20,27 @@
namespace {{this}} {
{{/cppNamespaceDeclarations}}
template <typename T>
class OptionalParam {
public:
T m_Value;
bool m_hasValue;
public:
OptionalParam(){
m_hasValue = false;
}
OptionalParam(const T &val){
m_hasValue = true;
m_Value = val;
}
bool hasValue() const {
return m_hasValue;
}
T value() const{
return m_Value;
}
};
bool setDateTimeFormat(const QString&);
template <typename T>

Some files were not shown because too many files have changed in this diff Show More