Compare commits

...

26 Commits

Author SHA1 Message Date
William Cheng
197294a167 Prepare 4.1.1 release (#3756)
* 4.1.1 release

* update doc
2019-08-26 15:59:33 +08:00
William Cheng
7afd350616 [WIP] Escape import with underscore in go-experimental client (#3659)
* escape import with underscore in go client

* update ioutil

* Fix collectionFormat=multi request bug in go experimental
2019-08-26 10:38:24 +08:00
William Cheng
7e772e1b71 comment out qt5 cpp tests 2019-08-26 09:30:30 +08:00
Jim Schubert
ee7c8a82e8 [BUG][CLI][GENERATOR] NullPointer when not setting outputDir (updated) (#3752)
* Fixes NPE when no outputDir is set

* Fix behaviors of default values for values not provided by user

* Easier handling of default behavior in settings.

* Fixes for dynamic config deserialization (specifically, ruby client sample fix)

* Tests for WorkflowSettings (defaults, modified defaults, nulls)

* Test modification of WorkflowSettings defaults for both class constructor and builder
2019-08-25 19:19:52 -04:00
William Cheng
136c1407ac Move tests to Drone.io CI (#3754)
* move tests to drone.io

* ls dir

* debug

* use bash

* use jdk 11 image

* move tests to drone.io

* use maven wrapper

* comment out scripts in circleci

* update dart samples

* remove commented tests

* update dart samples
2019-08-26 00:35:51 +08:00
William Cheng
5289262aec Add a link to bitmovin blog post (#3753) 2019-08-25 23:19:04 +08:00
William Cheng
cba2d3b8cf Merge branch 'master' of https://github.com/OpenAPITools/openapi-generator 2019-08-25 18:05:50 +08:00
William Cheng
cd6b844d75 update python samples 2019-08-25 18:05:37 +08:00
FlorianBruckner
16ac05dcdf Two tiny fixes for Java Vertx client (#3683)
* two tiny fixes:

1.) ApiClient already defines and configures an objectMapper to not fail on unknown properties, but it is not used when parsing the response. The fix uses the pre-configured object mapper instead of the vertx default one

2.) When an operation has no response (or just ones without content), the accept array passed to ApiClient is emtpy. This makes the null check in ApiClient useless, as it still tries to set a null Accept header, which is refused with an NPE. Amend the check with .length > 0 to catch this case.

* update generated client as required by contributor guidelines
2019-08-25 18:02:36 +08:00
Andreas Kägi
859df23428 Exclude "test" from packages so that it is not installed as top-level package when "pip installing" the generated sdk (#3731) 2019-08-25 17:59:38 +08:00
sullis
e12459f3bd [java-client] add unit test for JDK 11 HttpClient (#3735) 2019-08-25 17:15:46 +08:00
Ramanth Addala
8cd5a4187b [R] feat(r): handling error response for 3xx cases (#3571)
* feat(r): handling error response for 3xx cases

* fix(r) : changed the message for 3XX case

* fix(r) : fixing the status code 3xx
2019-08-25 01:21:03 +08:00
Nick Meinhold
a05f68431a [Dart] Avoid redundant null checking in fromJson (#3632)
* Move dart null checks inside mustache type checks

- removed surrounding null check
- added a conditional expression to each case except the redundant one

* Run shell scripts so CIs can verify the change
2019-08-25 01:16:32 +08:00
Jim Schubert
15f680e1eb [core] Set isMultipart=true for multipart operations, fix possible NPE (#3750) 2019-08-25 01:02:12 +08:00
William Cheng
0beb8caa85 reenable kotlin client tests in shippable ci (#3751) 2019-08-25 00:53:11 +08:00
Armand Mégrot
1f5aa22f5c Fix null assignation to header/query param map (#3749)
Also regenerates the clients
2019-08-24 23:09:57 +08:00
sullis
dfb4c133d8 Mockito 3.0.0 (#3732) 2019-08-24 21:40:24 +08:00
Jérémie Bresson
286ddf38f7 Update to swagger-parser to 2.0.14-OpenAPITools.org-1 (#3737) 2019-08-24 10:40:05 +02:00
William Cheng
761e435248 Add a link to a Qiita blog post (#3747)
Add a link to a Qiita blog post
2019-08-24 11:59:47 +08:00
William Cheng
1188d0f141 update csharp samples 2019-08-24 11:55:16 +08:00
Jake Moening
a390676cc6 Simple spelling error in dotnet core comments (#3746)
* Simple spelling error in dotnet core comments

Dictioary -> Dictionary

* Updated the sample files as well.
2019-08-24 11:35:11 +08:00
William Cheng
b8f9e995ce better support for multipart (#3736) 2019-08-24 11:24:51 +08:00
Josh Giles
158cdfeb3c [typescript-fetch] fix #1998: prefix req ifaces. (#3740)
Prefix generated request interface names with API classname rather than
using namespaces, because namespaces are not well-supported by some
tooling (in particular, Babel).
2019-08-23 16:58:51 +02:00
Martin Delille
1fc03c88b2 cpp-qt5-client: add valgrind memory test (#3663) 2019-08-23 14:23:47 +02:00
Daniel Schreiber
d64ec14ab4 [typescript-angular] Encode objects for multipart/form-data with json - fixes #2733 (#3738) 2019-08-23 13:54:14 +02:00
thecrazzymouse
73eae09738 [BUG] Https protocol schema is not handled correctly in java 11 native code #3729 (#3730)
* added getter for schema
2019-08-23 13:52:48 +02:00
261 changed files with 1991 additions and 1605 deletions

View File

@@ -94,6 +94,8 @@ before_install:
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
# - . ~/otp/18.2.1/activate && erl -version
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
# install valgrind for C++ memory test
- sudo apt-get install valgrind
# install Qt 5.10
- sudo add-apt-repository --yes ppa:beineri/opt-qt-5.10.1-trusty
- sudo apt-get update -qq

View File

@@ -11,10 +11,18 @@ steps:
- (cd samples/client/petstore/dart2/openapi && pub get && pub run test)
# test Java 11 HTTP client
- name: java11-test
image: hirokimatsumoto/alpine-openjdk-11
image: openjdk:11.0
commands:
- ./mvnw clean install
- ./mvnw --quiet verify -Psamples.droneio
# test all generators with fake petstore spec (2.0, 3.0)
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
# generate test scripts
- /bin/bash bin/tests/run-all-test
# generate all petstore samples (client, servers, doc)
- /bin/bash bin/run-all-petstore
# generate all petstore samples (openapi3)
- /bin/bash bin/openapi3/run-all-petstore
# test ocaml petstore client
- name: ocaml-test
image: ocaml/opam2:4.07

View File

@@ -14,14 +14,6 @@ if [ "$NODE_INDEX" = "1" ]; then
mvn --quiet verify -Psamples.circleci
mvn --quiet javadoc:javadoc -Psamples.circleci
# generate all petstore samples (client, servers, doc)
./bin/run-all-petstore
# generate all petstore samples (openapi3)
./bin/openapi3/run-all-petstore
# generate test scripts
./bin/tests/run-all-test
# test all generators with fake petstore spec (2.0, 3.0)
./bin/utils/test-fake-petstore-for-all.sh
elif [ "$NODE_INDEX" = "2" ]; then
# 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`
@@ -29,12 +21,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
echo "Running node $NODE_INDEX to test ensure-up-to-date"
java -version
# install elm-format for formatting elm code
npm install -g elm-format
# symlink elm-format
sudo ln -s /opt/circleci/.nvm/versions/node/v12.1.0/bin/elm-format /usr/local/bin/elm-format
./bin/utils/ensure-up-to-date
fi
#elif [ "$NODE_INDEX" = "3" ]; then

View File

@@ -1,7 +1,7 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests</artifactId>
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>

View File

@@ -2,7 +2,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.1.0`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.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)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
@@ -108,8 +108,8 @@ OpenAPI Generator Version | Release Date | Notes
---------------------------- | ------------ | -----
5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback)
4.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.0-SNAPSHOT/)| 09.10.2019 | Minor release (breaking changes with fallbacks)
4.1.1 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.1-SNAPSHOT/)| 23.08.2019 | Patch release (bug fixes, enhancements)
[4.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.1.0) (latest stable release) | 09.08.2019 | Minor release (breaking changes with fallbacks)
4.1.1 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.1/)| 23.08.2019 | Patch release (bug fixes, enhancements)
[4.1.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.1.1) (latest stable release) | 09.08.2019 | Minor release (breaking changes with fallbacks)
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
@@ -165,16 +165,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: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar`
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.1/openapi-generator-cli-4.1.1.jar`
For **Mac/Linux** users:
```sh
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar -O openapi-generator-cli.jar
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.1/openapi-generator-cli-4.1.1.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 http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.1/openapi-generator-cli-4.1.1.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -389,10 +389,10 @@ openapi-generator version
```
<!-- RELEASE_VERSION -->
Or install a particular OpenAPI Generator version (e.g. v4.1.0):
Or install a particular OpenAPI Generator version (e.g. v4.1.1):
```sh
npm install @openapitools/openapi-generator-cli@cli-4.1.0 -g
npm install @openapitools/openapi-generator-cli@cli-4.1.1 -g
```
Or install it as dev-dependency:
@@ -416,7 +416,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/2_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](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar)
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.1/openapi-generator-cli-4.1.1.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`
@@ -627,6 +627,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2019-07-08 - [OpenAPI Generator にコントリビュートしたら社名が載った話。(CAM) - CAM TECH BLOG](https://tech.cam-inc.co.jp/entry/2019/07/08/140000) by [CAM, Inc.](https://www.cam-inc.co.jp/)
- 2019-07-14 - [OpenAPI GeneratorでPythonのクライアントライブラリを作成した](https://qiita.com/yuji38kwmt/items/dfb929316a1335a161c0) by [yuji38kwmt](https://qiita.com/yuji38kwmt)
- 2019-07-19 - [Developer Experience (DX) for Open-Source Projects: How to Engage Developers and Build a Growing Developer Community](https://speakerdeck.com/wing328/developer-experience-dx-for-open-source-projects-english-japanese) by [William Cheng](https://twitter.com/wing328), [中野暁人](https://github.com/ackintosh) at [Open Source Summit Japan 2019](https://events.linuxfoundation.org/events/open-source-summit-japan-2019/)
- 2019-08-14 - [Our OpenAPI journey with Standardizing SDKs](https://bitmovin.com/our-openapi-journey-with-standardizing-sdks/) by [Sebastian Burgstaller](https://bitmovin.com/author/sburgstaller/) at [Bitmovin](https://www.bitmovin.com)
- 2019-08-24 - [SwaggerドキュメントからOpenAPI Generatorを使ってモックサーバー作成](https://qiita.com/masayoshi0222/items/4845e4c715d04587c104) by [坂本正義](https://qiita.com/masayoshi0222)
## [6 - About Us](#table-of-contents)

View File

@@ -22,7 +22,7 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
./mvnw -B clean package
fi
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
@@ -30,7 +30,7 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
java $JAVA_OPTS -jar $executable $ags
mvn clean package -f samples/meta-codegen/pom.xml
./mvnw clean package -f samples/meta-codegen/pom.xml
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"

View File

@@ -4,4 +4,4 @@
./bin/openapi3/typescript-fetch-petstore-with-npm-version.sh
./bin/openapi3/typescript-fetch-petstore-interfaces.sh
./bin/openapi3/typescript-fetch-petstore.sh
./bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh
./bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true $@"
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -2,5 +2,6 @@
"gemName": "petstore",
"moduleName": "Petstore",
"library": "faraday",
"gemVersion": "1.0.0"
"gemVersion": "1.0.0",
"strictSpecBehavior": false
}

View File

@@ -2,5 +2,6 @@
"gemName": "petstore",
"library": "typhoeus",
"moduleName": "Petstore",
"gemVersion": "1.0.0"
"gemVersion": "1.0.0",
"strictSpecBehavior": false
}

View File

@@ -5,4 +5,4 @@
./bin/typescript-fetch-petstore-interfaces.sh
./bin/typescript-fetch-petstore.sh
./bin/typescript-fetch-petstore-multiple-parameters.sh
./bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh
./bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh

View File

@@ -3,5 +3,5 @@
"npmVersion": "1.0.0",
"npmRepository" : "https://skimdb.npmjs.com/registry",
"snapshot" : false,
"namespaceParameterInterfaces": true
"prefixParameterInterfaces": true
}

View File

@@ -27,8 +27,8 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-namespace-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces $@"
java $JAVA_OPTS -jar $executable $ags
cp CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml
cp CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml

View File

@@ -5,4 +5,4 @@ call bin\windows\typescript-fetch-petstore-target-es6.bat
call bin\windows\typescript-fetch-petstore-with-npm-version.bat
call bin\windows\typescript-fetch-petstore-interfaces.bat
call bin\windows\typescript-fetch-petstore-multiple-parameters.bat
call bin\windows\typescript-fetch-petstore-namespace-parameter-interfaces.bat
call bin\windows\typescript-fetch-petstore-prefix-parameter-interfaces.bat

View File

@@ -7,6 +7,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -19,4 +19,4 @@ sidebar_label: typescript-fetch
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|namespaceParameterInterfaces|Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.| |false|
|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false|

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -421,13 +421,27 @@ public final class GeneratorSettings implements Serializable {
builder.artifactId = copy.getArtifactId();
builder.artifactVersion = copy.getArtifactVersion();
builder.library = copy.getLibrary();
builder.instantiationTypes = new HashMap<>(copy.getInstantiationTypes());
builder.typeMappings = new HashMap<>(copy.getTypeMappings());
builder.additionalProperties = new HashMap<>(copy.getAdditionalProperties());
builder.importMappings = new HashMap<>(copy.getImportMappings());
builder.languageSpecificPrimitives = new HashSet<>(copy.getLanguageSpecificPrimitives());
builder.reservedWordMappings = new HashMap<>(copy.getReservedWordMappings());
builder.serverVariables = new HashMap<>(copy.getServerVariables());
if (copy.getInstantiationTypes() != null) {
builder.instantiationTypes.putAll(copy.getInstantiationTypes());
}
if (copy.getTypeMappings() != null) {
builder.typeMappings.putAll(copy.getTypeMappings());
}
if (copy.getAdditionalProperties() != null) {
builder.additionalProperties.putAll(copy.getAdditionalProperties());
}
if (copy.getImportMappings() != null) {
builder.importMappings.putAll(copy.getImportMappings());
}
if (copy.getLanguageSpecificPrimitives() != null) {
builder.languageSpecificPrimitives.addAll(copy.getLanguageSpecificPrimitives());
}
if (copy.getReservedWordMappings() != null) {
builder.reservedWordMappings.putAll(copy.getReservedWordMappings());
}
if (copy.getServerVariables() != null) {
builder.serverVariables.putAll(copy.getServerVariables());
}
builder.gitUserId = copy.getGitUserId();
builder.gitRepoId = copy.getGitRepoId();
builder.releaseNote = copy.getReleaseNote();

View File

@@ -33,38 +33,48 @@ import java.util.Objects;
public class WorkflowSettings {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class);
public static final String DEFAULT_OUTPUT_DIR = ".";
public static final boolean DEFAULT_VERBOSE = false;
public static final boolean DEFAULT_SKIP_OVERWRITE = false;
public static final boolean DEFAULT_REMOVE_OPERATION_ID_PREFIX = false;
public static final boolean DEFAULT_LOG_TO_STDERR = false;
public static final boolean DEFAULT_VALIDATE_SPEC = true;
public static final boolean DEFAULT_ENABLE_POST_PROCESS_FILE = false;
public static final boolean DEFAULT_ENABLE_MINIMAL_UPDATE = false;
public static final boolean DEFAULT_STRICT_SPEC_BEHAVIOR = true;
public static final String DEFAULT_TEMPLATING_ENGINE_NAME = "mustache";
public static final ImmutableMap<String, String> DEFAULT_SYSTEM_PROPERTIES = ImmutableMap.of();
private String inputSpec;
private String outputDir;
private boolean verbose;
private boolean skipOverwrite;
private boolean removeOperationIdPrefix;
private boolean logToStderr;
private boolean validateSpec;
private boolean enablePostProcessFile;
private boolean enableMinimalUpdate;
private boolean strictSpecBehavior;
private String outputDir = DEFAULT_OUTPUT_DIR;
private boolean verbose = DEFAULT_VERBOSE;
private boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
private boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
private boolean logToStderr = DEFAULT_LOG_TO_STDERR;
private boolean validateSpec = DEFAULT_VALIDATE_SPEC;
private boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
private boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
private boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
private String templateDir;
private String templatingEngineName;
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride;
private ImmutableMap<String, String> systemProperties;
private ImmutableMap<String, String> systemProperties = DEFAULT_SYSTEM_PROPERTIES;
private WorkflowSettings(Builder builder) {
setDefaults();
inputSpec = builder.inputSpec;
outputDir = builder.outputDir;
verbose = builder.verbose;
skipOverwrite = builder.skipOverwrite;
removeOperationIdPrefix = builder.removeOperationIdPrefix;
logToStderr = builder.logToStderr;
validateSpec = builder.validateSpec;
enablePostProcessFile = builder.enablePostProcessFile;
enableMinimalUpdate = builder.enableMinimalUpdate;
strictSpecBehavior = builder.strictSpecBehavior;
templateDir = builder.templateDir;
templatingEngineName = builder.templatingEngineName;
ignoreFileOverride = builder.ignoreFileOverride;
systemProperties = ImmutableMap.copyOf(builder.systemProperties);
this.inputSpec = builder.inputSpec;
this.outputDir = builder.outputDir;
this.verbose = builder.verbose;
this.skipOverwrite = builder.skipOverwrite;
this.removeOperationIdPrefix = builder.removeOperationIdPrefix;
this.logToStderr = builder.logToStderr;
this.validateSpec = builder.validateSpec;
this.enablePostProcessFile = builder.enablePostProcessFile;
this.enableMinimalUpdate = builder.enableMinimalUpdate;
this.strictSpecBehavior = builder.strictSpecBehavior;
this.templateDir = builder.templateDir;
this.templatingEngineName = builder.templatingEngineName;
this.ignoreFileOverride = builder.ignoreFileOverride;
this.systemProperties = ImmutableMap.copyOf(builder.systemProperties);
}
/**
@@ -72,14 +82,7 @@ public class WorkflowSettings {
*/
@SuppressWarnings("unused")
public WorkflowSettings() {
setDefaults();
systemProperties = ImmutableMap.of();
}
private void setDefaults(){
validateSpec = true;
strictSpecBehavior = true;
outputDir = ".";
}
public static Builder newBuilder() {
@@ -87,7 +90,7 @@ public class WorkflowSettings {
}
public static Builder newBuilder(WorkflowSettings copy) {
Builder builder = new Builder();
Builder builder = newBuilder();
builder.inputSpec = copy.getInputSpec();
builder.outputDir = copy.getOutputDir();
builder.verbose = copy.isVerbose();
@@ -257,24 +260,24 @@ public class WorkflowSettings {
@SuppressWarnings("unused")
public static final class Builder {
private String inputSpec;
private String outputDir;
private boolean verbose;
private boolean skipOverwrite;
private boolean removeOperationIdPrefix;
private boolean logToStderr;
private boolean validateSpec;
private boolean enablePostProcessFile;
private boolean enableMinimalUpdate;
private boolean strictSpecBehavior;
private String outputDir = DEFAULT_OUTPUT_DIR;
private Boolean verbose = DEFAULT_VERBOSE;
private Boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
private Boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
private Boolean logToStderr = DEFAULT_LOG_TO_STDERR;
private Boolean validateSpec = DEFAULT_VALIDATE_SPEC;
private Boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
private Boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
private Boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
private String templateDir;
private String templatingEngineName;
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride;
private Map<String, String> systemProperties;
private Map<String, String> systemProperties = new HashMap<>();;
private Builder() {
systemProperties = new HashMap<>();
}
/**
* Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together.
*
@@ -282,7 +285,9 @@ public class WorkflowSettings {
* @return a reference to this Builder
*/
public Builder withInputSpec(String inputSpec) {
this.inputSpec = inputSpec;
if (inputSpec != null) {
this.inputSpec = inputSpec;
}
return this;
}
@@ -293,7 +298,11 @@ public class WorkflowSettings {
* @return a reference to this Builder
*/
public Builder withOutputDir(String outputDir) {
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();;
if (outputDir != null ) {
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();
} else {
this.outputDir = DEFAULT_OUTPUT_DIR;
}
return this;
}
@@ -303,8 +312,8 @@ public class WorkflowSettings {
* @param verbose the {@code verbose} to set
* @return a reference to this Builder
*/
public Builder withVerbose(boolean verbose) {
this.verbose = verbose;
public Builder withVerbose(Boolean verbose) {
this.verbose = verbose != null ? verbose : Boolean.valueOf(DEFAULT_VERBOSE);
return this;
}
@@ -314,8 +323,8 @@ public class WorkflowSettings {
* @param skipOverwrite the {@code skipOverwrite} to set
* @return a reference to this Builder
*/
public Builder withSkipOverwrite(boolean skipOverwrite) {
this.skipOverwrite = skipOverwrite;
public Builder withSkipOverwrite(Boolean skipOverwrite) {
this.skipOverwrite = skipOverwrite != null ? skipOverwrite : Boolean.valueOf(DEFAULT_SKIP_OVERWRITE);
return this;
}
@@ -325,8 +334,8 @@ public class WorkflowSettings {
* @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set
* @return a reference to this Builder
*/
public Builder withRemoveOperationIdPrefix(boolean removeOperationIdPrefix) {
this.removeOperationIdPrefix = removeOperationIdPrefix;
public Builder withRemoveOperationIdPrefix(Boolean removeOperationIdPrefix) {
this.removeOperationIdPrefix = removeOperationIdPrefix != null ? removeOperationIdPrefix : Boolean.valueOf(DEFAULT_REMOVE_OPERATION_ID_PREFIX);
return this;
}
@@ -336,8 +345,8 @@ public class WorkflowSettings {
* @param logToStderr the {@code logToStderr} to set
* @return a reference to this Builder
*/
public Builder withLogToStderr(boolean logToStderr) {
this.logToStderr = logToStderr;
public Builder withLogToStderr(Boolean logToStderr) {
this.logToStderr = logToStderr != null ? logToStderr : Boolean.valueOf(DEFAULT_LOG_TO_STDERR);
return this;
}
@@ -347,8 +356,8 @@ public class WorkflowSettings {
* @param validateSpec the {@code validateSpec} to set
* @return a reference to this Builder
*/
public Builder withValidateSpec(boolean validateSpec) {
this.validateSpec = validateSpec;
public Builder withValidateSpec(Boolean validateSpec) {
this.validateSpec = validateSpec != null ? validateSpec : Boolean.valueOf(DEFAULT_VALIDATE_SPEC);
return this;
}
@@ -358,8 +367,8 @@ public class WorkflowSettings {
* @param enablePostProcessFile the {@code enablePostProcessFile} to set
* @return a reference to this Builder
*/
public Builder withEnablePostProcessFile(boolean enablePostProcessFile) {
this.enablePostProcessFile = enablePostProcessFile;
public Builder withEnablePostProcessFile(Boolean enablePostProcessFile) {
this.enablePostProcessFile = enablePostProcessFile != null ? enablePostProcessFile : Boolean.valueOf(DEFAULT_ENABLE_POST_PROCESS_FILE);
return this;
}
@@ -369,8 +378,8 @@ public class WorkflowSettings {
* @param enableMinimalUpdate the {@code enableMinimalUpdate} to set
* @return a reference to this Builder
*/
public Builder withEnableMinimalUpdate(boolean enableMinimalUpdate) {
this.enableMinimalUpdate = enableMinimalUpdate;
public Builder withEnableMinimalUpdate(Boolean enableMinimalUpdate) {
this.enableMinimalUpdate = enableMinimalUpdate != null ? enableMinimalUpdate : Boolean.valueOf(DEFAULT_ENABLE_MINIMAL_UPDATE);
return this;
}
@@ -380,8 +389,8 @@ public class WorkflowSettings {
* @param strictSpecBehavior the {@code strictSpecBehavior} to set
* @return a reference to this Builder
*/
public Builder withStrictSpecBehavior(boolean strictSpecBehavior) {
this.strictSpecBehavior = strictSpecBehavior;
public Builder withStrictSpecBehavior(Boolean strictSpecBehavior) {
this.strictSpecBehavior = strictSpecBehavior != null ? strictSpecBehavior : Boolean.valueOf(DEFAULT_STRICT_SPEC_BEHAVIOR);
return this;
}
@@ -392,9 +401,7 @@ public class WorkflowSettings {
* @return a reference to this Builder
*/
public Builder withTemplateDir(String templateDir) {
if (templateDir == null) {
this.templateDir = null;
} else {
if (templateDir != null) {
File f = new File(templateDir);
// check to see if the folder exists
@@ -416,7 +423,7 @@ public class WorkflowSettings {
* @return a reference to this Builder
*/
public Builder withTemplatingEngineName(String templatingEngineName) {
this.templatingEngineName = templatingEngineName;
this.templatingEngineName = templatingEngineName != null ? templatingEngineName : DEFAULT_TEMPLATING_ENGINE_NAME;
return this;
}
@@ -438,7 +445,9 @@ public class WorkflowSettings {
* @return a reference to this Builder
*/
public Builder withSystemProperties(Map<String, String> systemProperties) {
this.systemProperties = systemProperties;
if (systemProperties != null) {
this.systemProperties = systemProperties;
}
return this;
}

View File

@@ -0,0 +1,103 @@
/*
* Copyright 2019 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
*
* http://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.config;
import org.testng.annotations.Test;
import java.nio.file.Paths;
import static org.testng.Assert.*;
public class WorkflowSettingsTest {
@Test
public void defaultValuesNotOverriddenByNulls(){
WorkflowSettings settings = WorkflowSettings.newBuilder()
.withOutputDir(null)
.withVerbose(null)
.withSkipOverwrite(null)
.withRemoveOperationIdPrefix(null)
.withLogToStderr(null)
.withValidateSpec(null)
.withEnablePostProcessFile(null)
.withEnableMinimalUpdate(null)
.withStrictSpecBehavior(null)
.build();
assertEquals(settings.getOutputDir(), ".");
assertFalse(settings.isVerbose());
assertFalse(settings.isSkipOverwrite());
assertFalse(settings.isRemoveOperationIdPrefix());
assertFalse(settings.isLogToStderr());
assertTrue(settings.isValidateSpec());
assertFalse(settings.isEnablePostProcessFile());
assertFalse(settings.isEnableMinimalUpdate());
assertTrue(settings.isStrictSpecBehavior());
}
private void assertOnChangesToDefaults(WorkflowSettings defaults) {
WorkflowSettings settings = WorkflowSettings.newBuilder()
.withOutputDir("output")
.withVerbose(true)
.withSkipOverwrite(true)
.withRemoveOperationIdPrefix(true)
.withLogToStderr(true)
.withValidateSpec(false)
.withEnablePostProcessFile(true)
.withEnableMinimalUpdate(true)
.withStrictSpecBehavior(false)
.build();
assertNotEquals(defaults.getOutputDir(), settings.getOutputDir());
assertEquals(settings.getOutputDir(), Paths.get("output").toAbsolutePath().toString());
assertNotEquals(defaults.isVerbose(), settings.isVerbose());
assertTrue(settings.isVerbose());
assertNotEquals(defaults.isSkipOverwrite(), settings.isSkipOverwrite());
assertTrue(settings.isSkipOverwrite());
assertNotEquals(defaults.isRemoveOperationIdPrefix(), settings.isRemoveOperationIdPrefix());
assertTrue(settings.isRemoveOperationIdPrefix());
assertNotEquals(defaults.isLogToStderr(), settings.isLogToStderr());
assertTrue(settings.isLogToStderr());
assertNotEquals(defaults.isValidateSpec(), settings.isValidateSpec());
assertFalse(settings.isValidateSpec());
assertNotEquals(defaults.isEnablePostProcessFile(), settings.isEnablePostProcessFile());
assertTrue(settings.isEnablePostProcessFile());
assertNotEquals(defaults.isEnableMinimalUpdate(), settings.isEnableMinimalUpdate());
assertTrue(settings.isEnableMinimalUpdate());
assertNotEquals(defaults.isStrictSpecBehavior(), settings.isStrictSpecBehavior());
assertFalse(settings.isStrictSpecBehavior());
}
@Test
public void defaultValuesCanBeChangedClassConstructor(){
WorkflowSettings defaults = new WorkflowSettings();
assertOnChangesToDefaults(defaults);
}
@Test
public void defaultValuesCanBeChangedBuilder(){
WorkflowSettings defaults = WorkflowSettings.newBuilder().build();
assertOnChangesToDefaults(defaults);
}
}

View File

@@ -45,7 +45,7 @@ compileJava.dependsOn tasks.openApiGenerate
[source,group]
----
plugins {
id "org.openapi.generator" version "4.1.0"
id "org.openapi.generator" version "4.1.1"
}
----
@@ -61,7 +61,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:4.1.0"
classpath "org.openapitools:openapi-generator-gradle-plugin:4.1.1"
}
}
@@ -621,7 +621,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath('org.openapitools:openapi-generator-gradle-plugin:4.1.0') {
classpath('org.openapitools:openapi-generator-gradle-plugin:4.1.1') {
exclude group: 'com.google.guava'
}
}

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=4.1.1-SNAPSHOT
openApiGeneratorVersion=4.1.1
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -17,5 +17,5 @@ gradle generateGoWithInvalidSpec
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=4.1.0 openApiValidate
gradle -PopenApiGeneratorVersion=4.1.1 openApiValidate
```

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=4.1.0
openApiGeneratorVersion=4.1.1
# /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>4.1.0</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

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

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.0</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.0</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>
@@ -300,7 +300,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.0</version>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -2659,11 +2659,13 @@ public class DefaultCodegen implements CodegenConfig {
CodegenParameter bodyParam = null;
RequestBody requestBody = operation.getRequestBody();
if (requestBody != null) {
if (getContentType(requestBody) != null &&
(getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart/form-data"))) {
String contentType = getContentType(requestBody);
if (contentType != null &&
(contentType.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
contentType.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
// process form parameters
formParams = fromRequestBodyToFormParameters(requestBody, imports);
op.isMultipart = contentType.toLowerCase(Locale.ROOT).startsWith("multipart");
for (CodegenParameter cp : formParams) {
postProcessParameter(cp);
}
@@ -4463,8 +4465,8 @@ public class DefaultCodegen implements CodegenConfig {
for (String consume : consumesInfo) {
if (consume != null &&
consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
consume.toLowerCase(Locale.ROOT).startsWith("multipart/form-data")) {
(consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
consume.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
return true;
}
}
@@ -4907,7 +4909,7 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("The following schema has undefined (null) baseType. " +
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
"A correct 'consumes' for form parameters should be " +
"'application/x-www-form-urlencoded' or 'multipart/form-data'");
"'application/x-www-form-urlencoded' or 'multipart/?'");
LOGGER.warn("schema: " + schema);
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
codegenModelName = "UNKNOWN_BASE_TYPE";

View File

@@ -91,6 +91,7 @@ public class CodegenConfigurator {
DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class);
CodegenConfigurator configurator = new CodegenConfigurator();
configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings());
configurator.workflowSettingsBuilder = WorkflowSettings.newBuilder(settings.getWorkflowSettings());
return configurator;
} catch (IOException ex) {
LOGGER.error("Unable to deserialize config file: " + configFile, ex);

View File

@@ -33,11 +33,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
public static final String NPM_REPOSITORY = "npmRepository";
public static final String WITH_INTERFACES = "withInterfaces";
public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter";
public static final String NAMESPACE_PARAMETER_INTERFACES = "namespaceParameterInterfaces";
public static final String PREFIX_PARAMETER_INTERFACES = "prefixParameterInterfaces";
protected String npmRepository = null;
private boolean useSingleRequestParameter = true;
private boolean namespaceParameterInterfaces = false;
private boolean prefixParameterInterfaces = false;
protected boolean addedApiIndex = false;
protected boolean addedModelIndex = false;
@@ -61,7 +61,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
this.cliOptions.add(new CliOption(NAMESPACE_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(PREFIX_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
@Override
@@ -97,10 +97,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
}
writePropertyBack(USE_SINGLE_REQUEST_PARAMETER, getUseSingleRequestParameter());
if (additionalProperties.containsKey(NAMESPACE_PARAMETER_INTERFACES)) {
this.setNamespaceParameterInterfaces(convertPropertyToBoolean(NAMESPACE_PARAMETER_INTERFACES));
if (additionalProperties.containsKey(PREFIX_PARAMETER_INTERFACES)) {
this.setPrefixParameterInterfaces(convertPropertyToBoolean(PREFIX_PARAMETER_INTERFACES));
}
writePropertyBack(NAMESPACE_PARAMETER_INTERFACES, getNamespaceParameterInterfaces());
writePropertyBack(PREFIX_PARAMETER_INTERFACES, getPrefixParameterInterfaces());
if (additionalProperties.containsKey(NPM_NAME)) {
addNpmPackageGeneration();
@@ -216,7 +216,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.addOperationModelImportInfomation(operations);
this.updateOperationParameterEnumInformation(operations);
this.addOperationObjectResponseInformation(operations);
this.addOperationNamespaceParameterInterfacesInformation(operations);
this.addOperationPrefixParameterInterfacesInformation(operations);
return operations;
}
@@ -263,20 +263,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
}
}
private void addOperationNamespaceParameterInterfacesInformation(Map<String, Object> operations) {
private void addOperationPrefixParameterInterfacesInformation(Map<String, Object> operations) {
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
if (!operationList.isEmpty() && getNamespaceParameterInterfaces()) {
operations.put("namespaceParameterInterfaces", true);
operations.put("paramIfaceIndent", " ");
operations.put("paramIfaceSuffix", "");
operations.put("paramIfaceNsPrefix", operationList.get(0).baseName + "Requests.");
} else {
operations.put("namespaceParameterInterfaces", false);
operations.put("paramIfaceIndent", "");
operations.put("paramIfaceSuffix", "Request");
operations.put("paramIfaceNsPrefix", "");
}
operations.put("prefixParameterInterfaces", getPrefixParameterInterfaces());
}
private void addExtraReservedWords() {
@@ -315,11 +304,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.useSingleRequestParameter = useSingleRequestParameter;
}
private boolean getNamespaceParameterInterfaces() {
return namespaceParameterInterfaces;
private boolean getPrefixParameterInterfaces() {
return prefixParameterInterfaces;
}
private void setNamespaceParameterInterfaces(boolean namespaceParameterInterfaces) {
this.namespaceParameterInterfaces = namespaceParameterInterfaces;
private void setPrefixParameterInterfaces(boolean prefixParameterInterfaces) {
this.prefixParameterInterfaces = prefixParameterInterfaces;
}
}

View File

@@ -252,6 +252,17 @@ public class ApiClient {
return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
}
/**
* Set a custom scheme for the target service, for example 'https'.
*
* @param scheme The scheme of the target service
* @return This object.
*/
public ApiClient setScheme(String scheme){
this.scheme = scheme;
return this;
}
/**
* Set a custom request interceptor.
*

View File

@@ -444,7 +444,7 @@ public class ApiClient {
updateParamsForAuth(authNames, queryParams, headerParams);
if (accepts != null) {
if (accepts != null && accepts.length > 0) {
headerParams.add(HttpHeaders.ACCEPT, selectHeaderAccept(accepts));
}
@@ -579,7 +579,7 @@ public class ApiClient {
return;
} else {
try {
resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType);
resultContent = this.objectMapper.readValue(httpResponse.bodyAsString(), returnType);
result = Future.succeededFuture(resultContent);
} catch (Exception e) {
result = ApiException.fail(new DecodeException("Failed to decode:" + e.getMessage(), e));

View File

@@ -277,7 +277,7 @@ namespace {{packageName}}.Client
#region Private Members
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryRemove(T key, out IList<TValue> value)
{
@@ -299,7 +299,7 @@ namespace {{packageName}}.Client
}
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryAdd(T key, IList<TValue> value)
{

View File

@@ -16,51 +16,63 @@ class {{classname}} {
{{classname}}.fromJson(Map<String, dynamic> json) {
if (json == null) return;
{{#vars}}
if (json['{{baseName}}'] == null) {
{{name}} = null;
} else {
{{#isDateTime}}
{{name}} = DateTime.parse(json['{{baseName}}']);
{{name}} = (json['{{baseName}}'] == null) ?
null :
DateTime.parse(json['{{baseName}}']);
{{/isDateTime}}
{{#isDate}}
{{name}} = DateTime.parse(json['{{baseName}}']);
{{name}} = (json['{{baseName}}'] == null) ?
null :
DateTime.parse(json['{{baseName}}']);
{{/isDate}}
{{^isDateTime}}
{{^isDate}}
{{#complexType}}
{{#isListContainer}}
{{name}} = {{complexType}}.listFromJson(json['{{baseName}}']);
{{name}} = (json['{{baseName}}'] == null) ?
null :
{{complexType}}.listFromJson(json['{{baseName}}']);
{{/isListContainer}}
{{^isListContainer}}
{{#isMapContainer}}
{{name}} = {{complexType}}.mapFromJson(json['{{baseName}}']);
{{name}} = (json['{{baseName}}'] == null) ?
null :
{{complexType}}.mapFromJson(json['{{baseName}}']);
{{/isMapContainer}}
{{^isMapContainer}}
{{name}} = {{complexType}}.fromJson(json['{{baseName}}']);
{{name}} = (json['{{baseName}}'] == null) ?
null :
{{complexType}}.fromJson(json['{{baseName}}']);
{{/isMapContainer}}
{{/isListContainer}}
{{/complexType}}
{{^complexType}}
{{#isListContainer}}
{{name}} = (json['{{baseName}}'] as List).cast<{{items.datatype}}>();
{{name}} = (json['{{baseName}}'] == null) ?
null :
(json['{{baseName}}'] as List).cast<{{items.datatype}}>();
{{/isListContainer}}
{{^isListContainer}}
{{#isMapContainer}}
{{name}} = (json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
{{name}} = (json['{{baseName}}'] == null) ?
null :
(json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
{{/isMapContainer}}
{{^isMapContainer}}
{{#isDouble}}
{{name}} = json['{{baseName}}'].toDouble();
{{/isDouble}}
{{^isDouble}}
{{name}} = json['{{baseName}}'];
{{/isDouble}}
{{#isDouble}}
{{name}} = (json['{{baseName}}'] == null) ?
null :
json['{{baseName}}'].toDouble();
{{/isDouble}}
{{^isDouble}}
{{name}} = json['{{baseName}}'];
{{/isDouble}}
{{/isMapContainer}}
{{/isListContainer}}
{{/complexType}}
{{/isDate}}
{{/isDateTime}}
}
{{/vars}}
}

View File

@@ -3,17 +3,17 @@ package {{packageName}}
{{#operations}}
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
{{#imports}} "{{import}}"
{{/imports}}
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type {{classname}}Service service
@@ -24,7 +24,7 @@ type {{classname}}Service service
{{#notes}}
{{notes}}
{{/notes}}
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
{{#allParams}}
{{#required}}
* @param {{paramName}}{{#description}} {{{.}}}{{/description}}
@@ -63,9 +63,9 @@ type {{{nickname}}}Opts struct {
}
{{/hasOptionalParams}}
func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) {
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
var (
localVarHttpMethod = http.Method{{httpMethod}}
localVarHttpMethod = _nethttp.Method{{httpMethod}}
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -77,11 +77,11 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
// create path and map variables
localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", url.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}}
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
{{#allParams}}
{{#required}}
{{#minItems}}
@@ -132,11 +132,37 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
{{#hasQueryParams}}
{{#queryParams}}
{{#required}}
{{#isCollectionFormatMulti}}
t:={{paramName}}
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
} else {
localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{{/isCollectionFormatMulti}}
{{/required}}
{{^required}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
{{#isCollectionFormatMulti}}
t:=localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value()
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
} else {
localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{{/isCollectionFormatMulti}}
}
{{/required}}
{{/queryParams}}
@@ -192,7 +218,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
}
{{/required}}
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
@@ -277,7 +303,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err

View File

@@ -82,20 +82,22 @@ open class ApiClient(val baseUrl: String) {
{{#isKeyInQuery}}
if (requestConfig.query["{{keyParamName}}"].isNullOrEmpty()) {
{{/isKeyInQuery}}
if (apiKeyPrefix["{{keyParamName}}"] != null) {
{{#isKeyInHeader}}
requestConfig.headers["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"] + " " + apiKey["{{keyParamName}}"]
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"] + " " + apiKey["{{keyParamName}}"]
{{/isKeyInQuery}}
} else {
{{#isKeyInHeader}}
requestConfig.headers["{{keyParamName}}"] = apiKey["{{keyParamName}}"]
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKey["{{keyParamName}}"]
{{/isKeyInQuery}}
if (apiKey["{{keyParamName}}"] != null) {
if (apiKeyPrefix["{{keyParamName}}"] != null) {
{{#isKeyInHeader}}
requestConfig.headers["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
{{/isKeyInQuery}}
} else {
{{#isKeyInHeader}}
requestConfig.headers["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
{{/isKeyInQuery}}
}
}
}
{{/isApiKey}}

View File

@@ -32,7 +32,7 @@ setup(
url="{{packageUrl}}",
keywords=["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"],
install_requires=REQUIRES,
packages=find_packages(),
packages=find_packages(exclude=["test", "tests"]),
include_package_data=True,
long_description="""\
{{appDescription}} # noqa: E501

View File

@@ -291,6 +291,22 @@
{{! Returning the ApiResponse object with NULL object when the endpoint doesn't return anything}}
ApiResponse$new(NULL, resp)
{{/returnType}}
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
{{#returnExceptionOnFailure}}
errorMsg <- toString(content(resp))
if(errorMsg == ""){
errorMsg <- paste("Server returned " , httr::status_code(resp) , " response status code.")
}
{{#useDefaultExceptionHandling}}
stop(errorMsg)
{{/useDefaultExceptionHandling}}
{{#useRlangExceptionHandling}}
rlang::abort(message = errorMsg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
{{/useRlangExceptionHandling}}
{{/returnExceptionOnFailure}}
{{^returnExceptionOnFailure}}
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
{{/returnExceptionOnFailure}}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
{{#returnExceptionOnFailure}}
errorMsg <- toString(content(resp))

View File

@@ -342,7 +342,7 @@ export class {{classname}} {
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) {
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>{{paramName}}){{#useHttpClient}} as any || formParams{{/useHttpClient}};
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', {{^isModel}}<any>{{paramName}}{{/isModel}}{{#isModel}}useForm ? JSON.stringify({{paramName}}) : <any>{{paramName}}{{/isModel}}){{#useHttpClient}} as any || formParams{{/useHttpClient}};
}
{{/isListContainer}}
{{/formParams}}

View File

@@ -13,31 +13,16 @@ import {
{{/imports.0}}
{{#operations}}
{{#namespaceParameterInterfaces}}
{{#operation.0}}
/**
* Generated request parameter interface declarations (in namespace to avoid collisions).
*/
export namespace {{baseName}}Requests {
{{/operation.0}}
{{/namespaceParameterInterfaces}}
{{#operation}}
{{#allParams.0}}
{{paramIfaceIndent}}export interface {{operationIdCamelCase}}{{paramIfaceSuffix}} {
export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request {
{{#allParams}}
{{paramIfaceIndent}} {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/allParams}}
{{paramIfaceIndent}}}
}
{{/allParams.0}}
{{/operation}}
{{#namespaceParameterInterfaces}}
{{#operation.0}}
}
{{/operation.0}}
{{/namespaceParameterInterfaces}}
{{/operations}}
{{#operations}}
/**
@@ -54,7 +39,7 @@ export class {{classname}} extends runtime.BaseAPI {
* {{&summary}}
{{/summary}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise<runtime.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<runtime.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
{{#allParams}}
{{#required}}
if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) {
@@ -264,7 +249,7 @@ export class {{classname}} extends runtime.BaseAPI {
}
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
async {{nickname}}({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters{{/allParams.0}});
return await response.value();

View File

@@ -331,6 +331,44 @@ public class JavaClientCodegenTest {
output.deleteOnExit();
}
@Test
public void testJdkHttpClient() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put(JavaClientCodegen.JAVA8_MODE, true);
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("java")
.setLibrary(JavaClientCodegen.NATIVE)
.setAdditionalProperties(properties)
.setInputSpec("src/test/resources/3_0/ping.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(clientOptInput).generate();
Map<String, String> generatedFiles = generator.getFiles();
Assert.assertEquals(generatedFiles.size(), 23);
validateJavaSourceFiles(generatedFiles);
String defaultApiFilename = new File(output, "src/main/java/xyz/abcdef/api/DefaultApi.java").getAbsolutePath().replace("\\", "/");
String defaultApiContent = generatedFiles.get(defaultApiFilename);
assertTrue(defaultApiContent.contains("public class DefaultApi"));
assertTrue(defaultApiContent.contains("import java.net.http.HttpClient;"));
assertTrue(defaultApiContent.contains("import java.net.http.HttpRequest;"));
assertTrue(defaultApiContent.contains("import java.net.http.HttpResponse;"));
String apiClientFilename = new File(output, "src/main/java/xyz/abcdef/ApiClient.java").getAbsolutePath().replace("\\", "/");
String apiClientContent = generatedFiles.get(apiClientFilename);
assertTrue(apiClientContent.contains("public class ApiClient"));
assertTrue(apiClientContent.contains("import java.net.http.HttpClient;"));
assertTrue(apiClientContent.contains("import java.net.http.HttpRequest;"));
}
@Test
public void testReferencedHeader() {
final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/issue855.yaml");

View File

@@ -52,7 +52,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
.put(TypeScriptFetchClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.USE_SINGLE_REQUEST_PARAMETER, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.NAMESPACE_PARAMETER_INTERFACES, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.PREFIX_PARAMETER_INTERFACES, Boolean.FALSE.toString())
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
.build();

16
pom.xml
View File

@@ -10,7 +10,7 @@
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<!-- RELEASE_VERSION -->
<version>4.1.1-SNAPSHOT</version>
<version>4.1.1</version>
<!-- /RELEASE_VERSION -->
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
@@ -844,7 +844,7 @@
</modules>
</profile>
<profile>
<id>typescript-fetch-client-builds-namespace-parameter-interfaces</id>
<id>typescript-fetch-client-builds-prefix-parameter-interfaces</id>
<activation>
<property>
<name>env</name>
@@ -852,7 +852,7 @@
</property>
</activation>
<modules>
<module>samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces</module>
<module>samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces</module>
</modules>
</profile>
<profile>
@@ -1036,7 +1036,7 @@
<modules>
<!-- clients -->
<module>samples/client/petstore/c</module>
<module>samples/client/petstore/cpp-qt5</module>
<!-- <module>samples/client/petstore/cpp-qt5</module> -->
<module>samples/client/petstore/elm-0.18</module>
<module>samples/client/petstore/rust</module>
<module>samples/client/petstore/rust-reqwest</module>
@@ -1243,9 +1243,9 @@
<module>samples/client/petstore/elixir</module>
<module>samples/client/petstore/erlang-client</module>
<module>samples/client/petstore/erlang-proper</module>
<!--<module>samples/client/petstore/kotlin/</module>
<module>samples/client/petstore/kotlin/</module>
<module>samples/client/petstore/kotlin-threetenbp/</module>
<module>samples/client/petstore/kotlin-string/</module>-->
<module>samples/client/petstore/kotlin-string/</module>
<!-- servers -->
<module>samples/server/petstore/erlang-server</module>
<module>samples/server/petstore/jaxrs/jersey2</module>
@@ -1395,8 +1395,8 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<swagger-parser-groupid>org.openapitools.swagger.parser</swagger-parser-groupid>
<swagger-parser-version>2.0.13-OpenAPITools.org-2</swagger-parser-version>
<swagger-core-version>2.0.8</swagger-core-version>
<swagger-core-version>2.0.9</swagger-core-version>
<swagger-parser-version>2.0.14-OpenAPITools.org-1</swagger-parser-version>
<scala-version>2.11.1</scala-version>
<felix-version>3.3.1</felix-version>
<commons-io-version>2.4</commons-io-version>

View File

@@ -371,6 +371,8 @@ PetApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -417,6 +419,8 @@ PetApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -465,6 +469,8 @@ PetApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -513,6 +519,8 @@ PetApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -565,6 +573,8 @@ PetApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -611,6 +621,8 @@ PetApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -660,6 +672,8 @@ PetApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -715,6 +729,8 @@ PetApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -210,6 +210,8 @@ StoreApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -254,6 +256,8 @@ StoreApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -302,6 +306,8 @@ StoreApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -352,6 +358,8 @@ StoreApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -329,6 +329,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -374,6 +376,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -419,6 +423,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -461,6 +467,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -509,6 +517,8 @@ UserApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -561,6 +571,8 @@ UserApi <- R6::R6Class(
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -595,6 +607,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -647,6 +661,8 @@ UserApi <- R6::R6Class(
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -26,3 +26,6 @@ SOURCES += main.cpp \
HEADERS += PetApiTests.h \
StoreApiTests.h \
UserApiTests.h
# Disable optimisation for better valgrind report
QMAKE_CXXFLAGS_DEBUG += -O0

View File

@@ -2,10 +2,41 @@
set -e
mkdir build
mkdir -p build
cd build
qmake ../PetStore/PetStore.pro
qmake ../PetStore/PetStore.pro CONFIG+=debug
make
./PetStore
valgrind --leak-check=full ./PetStore |& tee result.log || exit 1
echo "Make sure the tests are launched:"
testCount=$(cat result.log | grep 'Finished testing of' | wc -l)
if [ $testCount == 3 ]
then
echo "Ok"
else
echo "The tests were not run!!!"
exit 1
fi
echo "Make sure the tests passed:"
successCount=$(cat result.log | grep '0 failed' | wc -l)
if [ $successCount == 3 ]
then
echo "Ok"
else
echo "The tests failed!!!"
exit 1
fi
echo "Check if no memory leaks occured:"
leakCount=$(cat result.log | grep 'lost: 0 bytes in 0 blocks' | wc -l)
if [ $leakCount == 3 ]
then
echo "Ok"
else
echo "There was memory leaks!!!"
exit 1
fi

View File

@@ -286,7 +286,7 @@ namespace Org.OpenAPITools.Client
#region Private Members
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryRemove(T key, out IList<TValue> value)
{
@@ -295,7 +295,7 @@ namespace Org.OpenAPITools.Client
}
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryAdd(T key, IList<TValue> value)
{

View File

@@ -286,7 +286,7 @@ namespace Org.OpenAPITools.Client
#region Private Members
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryRemove(T key, out IList<TValue> value)
{
@@ -295,7 +295,7 @@ namespace Org.OpenAPITools.Client
}
/**
* Helper method to encapsulate generator differences between dictioary types.
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryAdd(T key, IList<TValue> value)
{

View File

@@ -2,9 +2,9 @@ part of openapi.api;
class InlineObject {
/* Updated name of the pet */
String name = null;
String name = null;
/* Updated status of the pet */
String status = null;
String status = null;
InlineObject();
@override
@@ -14,16 +14,8 @@ class InlineObject {
InlineObject.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
name = json['name'];
status = json['status'];
}
Map<String, dynamic> toJson() {

View File

@@ -2,9 +2,9 @@ part of openapi.api;
class InlineObject1 {
/* Additional data to pass to server */
String additionalMetadata = null;
String additionalMetadata = null;
/* file to upload */
MultipartFile file = null;
MultipartFile file = null;
InlineObject1();
@override
@@ -14,16 +14,10 @@ class InlineObject1 {
InlineObject1.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['additionalMetadata'] == null) {
additionalMetadata = null;
} else {
additionalMetadata = json['additionalMetadata'];
}
if (json['file'] == null) {
file = null;
} else {
file = File.fromJson(json['file']);
}
additionalMetadata = json['additionalMetadata'];
file = (json['file'] == null) ?
null :
File.fromJson(json['file']);
}
Map<String, dynamic> toJson() {

View File

@@ -16,21 +16,9 @@ class ApiResponse {
ApiResponse.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['code'] == null) {
code = null;
} else {
code = json['code'];
}
if (json['type'] == null) {
type = null;
} else {
type = json['type'];
}
if (json['message'] == null) {
message = null;
} else {
message = json['message'];
}
code = json['code'];
type = json['type'];
message = json['message'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Category {
Category.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,14 @@ class Order {
Order.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['petId'] == null) {
petId = null;
} else {
petId = json['petId'];
}
if (json['quantity'] == null) {
quantity = null;
} else {
quantity = json['quantity'];
}
if (json['shipDate'] == null) {
shipDate = null;
} else {
shipDate = DateTime.parse(json['shipDate']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
if (json['complete'] == null) {
complete = null;
} else {
complete = json['complete'];
}
id = json['id'];
petId = json['petId'];
quantity = json['quantity'];
shipDate = (json['shipDate'] == null) ?
null :
DateTime.parse(json['shipDate']);
status = json['status'];
complete = json['complete'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,18 @@ class Pet {
Pet.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['category'] == null) {
category = null;
} else {
category = Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
if (json['photoUrls'] == null) {
photoUrls = null;
} else {
photoUrls = (json['photoUrls'] as List).cast<String>();
}
if (json['tags'] == null) {
tags = null;
} else {
tags = Tag.listFromJson(json['tags']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
id = json['id'];
category = (json['category'] == null) ?
null :
Category.fromJson(json['category']);
name = json['name'];
photoUrls = (json['photoUrls'] == null) ?
null :
(json['photoUrls'] as List).cast<String>();
tags = (json['tags'] == null) ?
null :
Tag.listFromJson(json['tags']);
status = json['status'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Tag {
Tag.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -26,46 +26,14 @@ class User {
User.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['username'] == null) {
username = null;
} else {
username = json['username'];
}
if (json['firstName'] == null) {
firstName = null;
} else {
firstName = json['firstName'];
}
if (json['lastName'] == null) {
lastName = null;
} else {
lastName = json['lastName'];
}
if (json['email'] == null) {
email = null;
} else {
email = json['email'];
}
if (json['password'] == null) {
password = null;
} else {
password = json['password'];
}
if (json['phone'] == null) {
phone = null;
} else {
phone = json['phone'];
}
if (json['userStatus'] == null) {
userStatus = null;
} else {
userStatus = json['userStatus'];
}
id = json['id'];
username = json['username'];
firstName = json['firstName'];
lastName = json['lastName'];
email = json['email'];
password = json['password'];
phone = json['phone'];
userStatus = json['userStatus'];
}
Map<String, dynamic> toJson() {

View File

@@ -16,21 +16,9 @@ class ApiResponse {
ApiResponse.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['code'] == null) {
code = null;
} else {
code = json['code'];
}
if (json['type'] == null) {
type = null;
} else {
type = json['type'];
}
if (json['message'] == null) {
message = null;
} else {
message = json['message'];
}
code = json['code'];
type = json['type'];
message = json['message'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Category {
Category.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,14 @@ class Order {
Order.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['petId'] == null) {
petId = null;
} else {
petId = json['petId'];
}
if (json['quantity'] == null) {
quantity = null;
} else {
quantity = json['quantity'];
}
if (json['shipDate'] == null) {
shipDate = null;
} else {
shipDate = DateTime.parse(json['shipDate']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
if (json['complete'] == null) {
complete = null;
} else {
complete = json['complete'];
}
id = json['id'];
petId = json['petId'];
quantity = json['quantity'];
shipDate = (json['shipDate'] == null) ?
null :
DateTime.parse(json['shipDate']);
status = json['status'];
complete = json['complete'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,18 @@ class Pet {
Pet.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['category'] == null) {
category = null;
} else {
category = Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
if (json['photoUrls'] == null) {
photoUrls = null;
} else {
photoUrls = (json['photoUrls'] as List).cast<String>();
}
if (json['tags'] == null) {
tags = null;
} else {
tags = Tag.listFromJson(json['tags']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
id = json['id'];
category = (json['category'] == null) ?
null :
Category.fromJson(json['category']);
name = json['name'];
photoUrls = (json['photoUrls'] == null) ?
null :
(json['photoUrls'] as List).cast<String>();
tags = (json['tags'] == null) ?
null :
Tag.listFromJson(json['tags']);
status = json['status'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Tag {
Tag.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -26,46 +26,14 @@ class User {
User.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['username'] == null) {
username = null;
} else {
username = json['username'];
}
if (json['firstName'] == null) {
firstName = null;
} else {
firstName = json['firstName'];
}
if (json['lastName'] == null) {
lastName = null;
} else {
lastName = json['lastName'];
}
if (json['email'] == null) {
email = null;
} else {
email = json['email'];
}
if (json['password'] == null) {
password = null;
} else {
password = json['password'];
}
if (json['phone'] == null) {
phone = null;
} else {
phone = json['phone'];
}
if (json['userStatus'] == null) {
userStatus = null;
} else {
userStatus = json['userStatus'];
}
id = json['id'];
username = json['username'];
firstName = json['firstName'];
lastName = json['lastName'];
email = json['email'];
password = json['password'];
phone = json['phone'];
userStatus = json['userStatus'];
}
Map<String, dynamic> toJson() {

View File

@@ -16,21 +16,9 @@ class ApiResponse {
ApiResponse.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['code'] == null) {
code = null;
} else {
code = json['code'];
}
if (json['type'] == null) {
type = null;
} else {
type = json['type'];
}
if (json['message'] == null) {
message = null;
} else {
message = json['message'];
}
code = json['code'];
type = json['type'];
message = json['message'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Category {
Category.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,14 @@ class Order {
Order.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['petId'] == null) {
petId = null;
} else {
petId = json['petId'];
}
if (json['quantity'] == null) {
quantity = null;
} else {
quantity = json['quantity'];
}
if (json['shipDate'] == null) {
shipDate = null;
} else {
shipDate = DateTime.parse(json['shipDate']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
if (json['complete'] == null) {
complete = null;
} else {
complete = json['complete'];
}
id = json['id'];
petId = json['petId'];
quantity = json['quantity'];
shipDate = (json['shipDate'] == null) ?
null :
DateTime.parse(json['shipDate']);
status = json['status'];
complete = json['complete'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,18 @@ class Pet {
Pet.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['category'] == null) {
category = null;
} else {
category = Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
if (json['photoUrls'] == null) {
photoUrls = null;
} else {
photoUrls = (json['photoUrls'] as List).cast<String>();
}
if (json['tags'] == null) {
tags = null;
} else {
tags = Tag.listFromJson(json['tags']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
id = json['id'];
category = (json['category'] == null) ?
null :
Category.fromJson(json['category']);
name = json['name'];
photoUrls = (json['photoUrls'] == null) ?
null :
(json['photoUrls'] as List).cast<String>();
tags = (json['tags'] == null) ?
null :
Tag.listFromJson(json['tags']);
status = json['status'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Tag {
Tag.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -26,46 +26,14 @@ class User {
User.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['username'] == null) {
username = null;
} else {
username = json['username'];
}
if (json['firstName'] == null) {
firstName = null;
} else {
firstName = json['firstName'];
}
if (json['lastName'] == null) {
lastName = null;
} else {
lastName = json['lastName'];
}
if (json['email'] == null) {
email = null;
} else {
email = json['email'];
}
if (json['password'] == null) {
password = null;
} else {
password = json['password'];
}
if (json['phone'] == null) {
phone = null;
} else {
phone = json['phone'];
}
if (json['userStatus'] == null) {
userStatus = null;
} else {
userStatus = json['userStatus'];
}
id = json['id'];
username = json['username'];
firstName = json['firstName'];
lastName = json['lastName'];
email = json['email'];
password = json['password'];
phone = json['phone'];
userStatus = json['userStatus'];
}
Map<String, dynamic> toJson() {

View File

@@ -16,21 +16,9 @@ class ApiResponse {
ApiResponse.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['code'] == null) {
code = null;
} else {
code = json['code'];
}
if (json['type'] == null) {
type = null;
} else {
type = json['type'];
}
if (json['message'] == null) {
message = null;
} else {
message = json['message'];
}
code = json['code'];
type = json['type'];
message = json['message'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Category {
Category.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,14 @@ class Order {
Order.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['petId'] == null) {
petId = null;
} else {
petId = json['petId'];
}
if (json['quantity'] == null) {
quantity = null;
} else {
quantity = json['quantity'];
}
if (json['shipDate'] == null) {
shipDate = null;
} else {
shipDate = DateTime.parse(json['shipDate']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
if (json['complete'] == null) {
complete = null;
} else {
complete = json['complete'];
}
id = json['id'];
petId = json['petId'];
quantity = json['quantity'];
shipDate = (json['shipDate'] == null) ?
null :
DateTime.parse(json['shipDate']);
status = json['status'];
complete = json['complete'];
}
Map<String, dynamic> toJson() {

View File

@@ -23,36 +23,18 @@ class Pet {
Pet.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['category'] == null) {
category = null;
} else {
category = Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
if (json['photoUrls'] == null) {
photoUrls = null;
} else {
photoUrls = (json['photoUrls'] as List).cast<String>();
}
if (json['tags'] == null) {
tags = null;
} else {
tags = Tag.listFromJson(json['tags']);
}
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
}
id = json['id'];
category = (json['category'] == null) ?
null :
Category.fromJson(json['category']);
name = json['name'];
photoUrls = (json['photoUrls'] == null) ?
null :
(json['photoUrls'] as List).cast<String>();
tags = (json['tags'] == null) ?
null :
Tag.listFromJson(json['tags']);
status = json['status'];
}
Map<String, dynamic> toJson() {

View File

@@ -14,16 +14,8 @@ class Tag {
Tag.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
}
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {

View File

@@ -26,46 +26,14 @@ class User {
User.fromJson(Map<String, dynamic> json) {
if (json == null) return;
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
}
if (json['username'] == null) {
username = null;
} else {
username = json['username'];
}
if (json['firstName'] == null) {
firstName = null;
} else {
firstName = json['firstName'];
}
if (json['lastName'] == null) {
lastName = null;
} else {
lastName = json['lastName'];
}
if (json['email'] == null) {
email = null;
} else {
email = json['email'];
}
if (json['password'] == null) {
password = null;
} else {
password = json['password'];
}
if (json['phone'] == null) {
phone = null;
} else {
phone = json['phone'];
}
if (json['userStatus'] == null) {
userStatus = null;
} else {
userStatus = json['userStatus'];
}
id = json['id'];
username = json['username'];
firstName = json['firstName'];
lastName = json['lastName'];
email = json['email'];
password = json['password'];
phone = json['phone'];
userStatus = json['userStatus'];
}
Map<String, dynamic> toJson() {

View File

@@ -1 +1 @@
4.1.0-SNAPSHOT
4.1.1-SNAPSHOT

View File

@@ -46,6 +46,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **Delete** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**TestQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **Put** /fake/test-query-paramters |
*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **Patch** /fake_classname_test | To test class name in snake case
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet

View File

@@ -1100,6 +1100,59 @@ paths:
tags:
- fake
x-codegen-request-body-name: body
/fake/test-query-paramters:
put:
description: To test the collection format in query parameters
operationId: testQueryParameterCollectionFormat
parameters:
- explode: false
in: query
name: pipe
required: true
schema:
items:
type: string
type: array
style: form
- in: query
name: ioutil
required: true
schema:
items:
type: string
type: array
- in: query
name: http
required: true
schema:
items:
type: string
type: array
style: spaceDelimited
- explode: false
in: query
name: url
required: true
schema:
items:
type: string
type: array
style: form
- explode: true
in: query
name: context
required: true
schema:
items:
type: string
type: array
style: form
responses:
200:
content: {}
description: Success
tags:
- fake
/fake/{petId}/uploadImageWithRequiredFile:
post:
operationId: uploadFileWithRequiredFile

View File

@@ -10,15 +10,15 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type AnotherFakeApiService service
@@ -26,13 +26,13 @@ type AnotherFakeApiService service
/*
AnotherFakeApiService To test special tags
To test special tags and operation ID starting with number
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model
@return Client
*/
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPatch
localVarHttpMethod = _nethttp.MethodPatch
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -44,8 +44,8 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body
localVarPath := a.client.cfg.BasePath + "/another-fake/dummy"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
@@ -76,7 +76,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err

View File

@@ -10,17 +10,18 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"github.com/antihax/optional"
"os"
"reflect"
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type FakeApiService service
@@ -28,12 +29,12 @@ type FakeApiService service
/*
FakeApiService creates an XmlItem
this route creates an XmlItem
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param xmlItem XmlItem Body
*/
func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*http.Response, error) {
func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -44,8 +45,8 @@ func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*h
localVarPath := a.client.cfg.BasePath + "/fake/create_xml_item"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16"}
@@ -76,7 +77,7 @@ func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*h
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -96,7 +97,7 @@ func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*h
/*
FakeApiService
Test serialization of outer boolean types
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters:
* @param "Body" (optional.Bool) - Input boolean as post body
@return bool
@@ -106,9 +107,9 @@ type FakeOuterBooleanSerializeOpts struct {
Body optional.Bool
}
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) {
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -120,8 +121,8 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -155,7 +156,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -194,7 +195,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
/*
FakeApiService
Test serialization of object with outer number type
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters:
* @param "Body" (optional.Interface of OuterComposite) - Input composite as post body
@return OuterComposite
@@ -204,9 +205,9 @@ type FakeOuterCompositeSerializeOpts struct {
Body optional.Interface
}
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) {
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -218,8 +219,8 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
localVarPath := a.client.cfg.BasePath + "/fake/outer/composite"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -257,7 +258,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -296,7 +297,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
/*
FakeApiService
Test serialization of outer number types
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters:
* @param "Body" (optional.Float32) - Input number as post body
@return float32
@@ -306,9 +307,9 @@ type FakeOuterNumberSerializeOpts struct {
Body optional.Float32
}
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) {
func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -320,8 +321,8 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
localVarPath := a.client.cfg.BasePath + "/fake/outer/number"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -355,7 +356,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -394,7 +395,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
/*
FakeApiService
Test serialization of outer string types
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters:
* @param "Body" (optional.String) - Input string as post body
@return string
@@ -404,9 +405,9 @@ type FakeOuterStringSerializeOpts struct {
Body optional.String
}
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) {
func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -418,8 +419,8 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
localVarPath := a.client.cfg.BasePath + "/fake/outer/string"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -453,7 +454,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -492,12 +493,12 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
/*
FakeApiService
For this test, the body for this request much reference a schema named &#x60;File&#x60;.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body
*/
func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSchemaTestClass) (*http.Response, error) {
func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileSchemaTestClass) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPut
localVarHttpMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -508,8 +509,8 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSc
localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
@@ -540,7 +541,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSc
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -559,13 +560,13 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSc
/*
FakeApiService
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param query
* @param body
*/
func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, body User) (*http.Response, error) {
func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, body User) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPut
localVarHttpMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -576,8 +577,8 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("query", parameterToString(query, ""))
// to determine the Content-Type header
@@ -609,7 +610,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -629,13 +630,13 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
/*
FakeApiService To test \"client\" model
To test \&quot;client\&quot; model
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model
@return Client
*/
func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) {
func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPatch
localVarHttpMethod = _nethttp.MethodPatch
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -647,8 +648,8 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
localVarPath := a.client.cfg.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
@@ -679,7 +680,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -718,7 +719,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
/*
FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param number None
* @param double None
* @param patternWithoutDelimiter None
@@ -749,9 +750,9 @@ type TestEndpointParametersOpts struct {
Callback optional.String
}
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) {
func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -762,8 +763,8 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
localVarPath := a.client.cfg.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if number < 32.1 {
return nil, reportError("number must be greater than 32.1")
}
@@ -823,7 +824,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
}
}
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
@@ -854,7 +855,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -874,7 +875,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
/*
FakeApiService To test enum parameters
To test enum parameters
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *TestEnumParametersOpts - Optional Parameters:
* @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array)
* @param "EnumHeaderString" (optional.String) - Header parameter enum test (string)
@@ -897,9 +898,9 @@ type TestEnumParametersOpts struct {
EnumFormString optional.String
}
func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) {
func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -910,8 +911,8 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
localVarPath := a.client.cfg.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if localVarOptionals != nil && localVarOptionals.EnumQueryStringArray.IsSet() {
localVarQueryParams.Add("enum_query_string_array", parameterToString(localVarOptionals.EnumQueryStringArray.Value(), "csv"))
@@ -964,7 +965,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -984,7 +985,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
/*
FakeApiService Fake endpoint to test group parameters (optional)
Fake endpoint to test group parameters (optional)
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param requiredStringGroup Required String in group parameters
* @param requiredBooleanGroup Required Boolean in group parameters
* @param requiredInt64Group Required Integer in group parameters
@@ -1000,9 +1001,9 @@ type TestGroupParametersOpts struct {
Int64Group optional.Int64
}
func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) {
func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodDelete
localVarHttpMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -1013,8 +1014,8 @@ func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredString
localVarPath := a.client.cfg.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("required_string_group", parameterToString(requiredStringGroup, ""))
localVarQueryParams.Add("required_int64_group", parameterToString(requiredInt64Group, ""))
@@ -1055,7 +1056,7 @@ func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredString
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -1074,12 +1075,12 @@ func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredString
/*
FakeApiService test inline additionalProperties
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param param request body
*/
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param map[string]string) (*http.Response, error) {
func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, param map[string]string) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -1090,8 +1091,8 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
@@ -1122,7 +1123,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -1141,13 +1142,13 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
/*
FakeApiService test json serialization of form data
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param param field1
* @param param2 field2
*/
func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) {
func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -1158,8 +1159,8 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
@@ -1190,7 +1191,90 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
/*
FakeApiService
To test the collection format in query parameters
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param pipe
* @param ioutil
* @param http
* @param url
* @param context
*/
func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/fake/test-query-paramters"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("pipe", parameterToString(pipe, "csv"))
localVarQueryParams.Add("ioutil", parameterToString(ioutil, "csv"))
localVarQueryParams.Add("http", parameterToString(http, "space"))
localVarQueryParams.Add("url", parameterToString(url, "csv"))
t:=context
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("context", parameterToString(s.Index(i), "multi"))
}
} else {
localVarQueryParams.Add("context", parameterToString(t, "multi"))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err

View File

@@ -10,15 +10,15 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type FakeClassnameTags123ApiService service
@@ -26,13 +26,13 @@ type FakeClassnameTags123ApiService service
/*
FakeClassnameTags123ApiService To test class name in snake case
To test class name in snake case
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model
@return Client
*/
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPatch
localVarHttpMethod = _nethttp.MethodPatch
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -44,8 +44,8 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
localVarPath := a.client.cfg.BasePath + "/fake_classname_test"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
@@ -88,7 +88,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err

View File

@@ -10,10 +10,10 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"fmt"
"strings"
"github.com/antihax/optional"
@@ -22,19 +22,19 @@ import (
// Linger please
var (
_ context.Context
_ _context.Context
)
type PetApiService service
/*
PetApiService Add a new pet to the store
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Pet object that needs to be added to the store
*/
func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) {
func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -45,8 +45,8 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
localVarPath := a.client.cfg.BasePath + "/pet"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "application/xml"}
@@ -77,7 +77,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -96,7 +96,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
/*
PetApiService Deletes a pet
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId Pet id to delete
* @param optional nil or *DeletePetOpts - Optional Parameters:
* @param "ApiKey" (optional.String) -
@@ -106,9 +106,9 @@ type DeletePetOpts struct {
ApiKey optional.String
}
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodDelete
localVarHttpMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -117,11 +117,11 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -153,7 +153,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -173,13 +173,13 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
/*
PetApiService Finds Pets by status
Multiple status values can be provided with comma separated strings
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param status Status values that need to be considered for filter
@return []Pet
*/
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -191,8 +191,8 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
localVarPath := a.client.cfg.BasePath + "/pet/findByStatus"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("status", parameterToString(status, "csv"))
// to determine the Content-Type header
@@ -222,7 +222,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -261,13 +261,13 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
/*
PetApiService Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param tags Tags to filter by
@return []Pet
*/
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -279,8 +279,8 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
localVarPath := a.client.cfg.BasePath + "/pet/findByTags"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
// to determine the Content-Type header
@@ -310,7 +310,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -349,13 +349,13 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
/*
PetApiService Find pet by ID
Returns a single pet
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to return
@return Pet
*/
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -365,11 +365,11 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -410,7 +410,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -448,12 +448,12 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
/*
PetApiService Update an existing pet
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Pet object that needs to be added to the store
*/
func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) {
func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPut
localVarHttpMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -464,8 +464,8 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
localVarPath := a.client.cfg.BasePath + "/pet"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "application/xml"}
@@ -496,7 +496,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -515,7 +515,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
/*
PetApiService Updates a pet in the store with form data
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet that needs to be updated
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
* @param "Name" (optional.String) - Updated name of the pet
@@ -527,9 +527,9 @@ type UpdatePetWithFormOpts struct {
Status optional.String
}
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -538,11 +538,11 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
@@ -577,7 +577,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -596,7 +596,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
/*
PetApiService uploads an image
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param optional nil or *UploadFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
@@ -609,9 +609,9 @@ type UploadFileOpts struct {
File optional.Interface
}
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -621,11 +621,11 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"multipart/form-data"}
@@ -657,7 +657,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
}
}
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
@@ -672,7 +672,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -710,7 +710,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
/*
PetApiService uploads an image (required)
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param requiredFile file to upload
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
@@ -722,9 +722,9 @@ type UploadFileWithRequiredFileOpts struct {
AdditionalMetadata optional.String
}
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -734,11 +734,11 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"multipart/form-data"}
@@ -763,7 +763,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in
localVarFormFileName = "requiredFile"
localVarFile := requiredFile
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
@@ -778,7 +778,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err

View File

@@ -10,17 +10,17 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"fmt"
"strings"
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type StoreApiService service
@@ -28,12 +28,12 @@ type StoreApiService service
/*
StoreApiService Delete purchase order by ID
For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of the order that needs to be deleted
*/
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodDelete
localVarHttpMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -42,11 +42,11 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -75,7 +75,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -95,12 +95,12 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
/*
StoreApiService Returns pet inventories by status
Returns a map of status codes to quantities
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return map[string]int32
*/
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -112,8 +112,8 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
localVarPath := a.client.cfg.BasePath + "/store/inventory"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -154,7 +154,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -193,13 +193,13 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
/*
StoreApiService Find purchase order by ID
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of pet that needs to be fetched
@return Order
*/
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -209,11 +209,11 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if orderId < 1 {
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
}
@@ -248,7 +248,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -286,13 +286,13 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
/*
StoreApiService Place an order for a pet
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body order placed for purchasing the pet
@return Order
*/
func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -304,8 +304,8 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *h
localVarPath := a.client.cfg.BasePath + "/store/order"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -336,7 +336,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *h
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err

View File

@@ -10,17 +10,17 @@
package petstore
import (
"context"
"io/ioutil"
"net/http"
"net/url"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"fmt"
"strings"
)
// Linger please
var (
_ context.Context
_ _context.Context
)
type UserApiService service
@@ -28,12 +28,12 @@ type UserApiService service
/*
UserApiService Create user
This can only be done by the logged in user.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Created user object
*/
func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) {
func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -44,8 +44,8 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
localVarPath := a.client.cfg.BasePath + "/user"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -76,7 +76,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -95,12 +95,12 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
/*
UserApiService Creates list of users with given input array
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body List of user object
*/
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) {
func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -111,8 +111,8 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
localVarPath := a.client.cfg.BasePath + "/user/createWithArray"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -143,7 +143,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -162,12 +162,12 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
/*
UserApiService Creates list of users with given input array
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body List of user object
*/
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) {
func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -178,8 +178,8 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
localVarPath := a.client.cfg.BasePath + "/user/createWithList"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -210,7 +210,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -230,12 +230,12 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
/*
UserApiService Delete user
This can only be done by the logged in user.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be deleted
*/
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodDelete
localVarHttpMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -244,11 +244,11 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -277,7 +277,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -296,13 +296,13 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
/*
UserApiService Get user by user name
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be fetched. Use user1 for testing.
@return User
*/
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -312,11 +312,11 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -345,7 +345,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -383,14 +383,14 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
/*
UserApiService Logs user into the system
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The user name for login
* @param password The password for login in clear text
@return string
*/
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -402,8 +402,8 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
localVarPath := a.client.cfg.BasePath + "/user/login"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("username", parameterToString(username, ""))
localVarQueryParams.Add("password", parameterToString(password, ""))
@@ -434,7 +434,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
@@ -472,11 +472,11 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
/*
UserApiService Logs out current logged in user session
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
*/
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -487,8 +487,8 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
localVarPath := a.client.cfg.BasePath + "/user/logout"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -517,7 +517,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
@@ -537,13 +537,13 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
/*
UserApiService Updated user
This can only be done by the logged in user.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username name that need to be deleted
* @param body Updated user object
*/
func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) {
func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) {
var (
localVarHttpMethod = http.MethodPut
localVarHttpMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
@@ -552,11 +552,11 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
@@ -587,7 +587,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,17 +4,17 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapString** | Pointer to **map[string]string** | | [optional]
**MapNumber** | Pointer to **map[string]float32** | | [optional]
**MapInteger** | Pointer to **map[string]int32** | | [optional]
**MapBoolean** | Pointer to **map[string]bool** | | [optional]
**MapArrayInteger** | Pointer to [**map[string][]int32**](array.md) | | [optional]
**MapArrayAnytype** | Pointer to [**map[string][]map[string]interface{}**](array.md) | | [optional]
**MapMapString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional]
**MapMapAnytype** | Pointer to [**map[string]map[string]map[string]interface{}**](map.md) | | [optional]
**Anytype1** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype2** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype3** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**MapString** | Pointer to **map[string]string** | | [optional]
**MapNumber** | Pointer to **map[string]float32** | | [optional]
**MapInteger** | Pointer to **map[string]int32** | | [optional]
**MapBoolean** | Pointer to **map[string]bool** | | [optional]
**MapArrayInteger** | Pointer to [**map[string][]int32**](array.md) | | [optional]
**MapArrayAnytype** | Pointer to [**map[string][]map[string]interface{}**](array.md) | | [optional]
**MapMapString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional]
**MapMapAnytype** | Pointer to [**map[string]map[string]map[string]interface{}**](map.md) | | [optional]
**Anytype1** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype2** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype3** | Pointer to [**map[string]interface{}**](.md) | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | Pointer to **string** | | [optional]
**Name** | Pointer to **string** | | [optional]
## Methods

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