forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 5.1.x
This commit is contained in:
19
README.md
19
README.md
@@ -77,9 +77,9 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, Rxjs) |
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0), **C++** (cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc** |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** |
|
||||
|
||||
@@ -450,10 +450,10 @@ To get a list of PHP specified options (which can be passed to the generator wit
|
||||
You can build a client against the [Petstore API](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml) as follows:
|
||||
|
||||
```sh
|
||||
./bin/java-petstore-okhttp-gson.sh
|
||||
./bin/generate-samples.sh ./bin/configs/java-okhttp-gson.yaml
|
||||
```
|
||||
|
||||
(On Windows, run `.\bin\windows\java-petstore-okhttp-gson.bat` instead)
|
||||
(On Windows, please install [GIT Bash for Windows](https://gitforwindows.org/) to run the command above)
|
||||
|
||||
This script uses the default library, which is `okhttp-gson`. It will run the generator with this command:
|
||||
|
||||
@@ -461,6 +461,8 @@ This script uses the default library, which is `okhttp-gson`. It will run the ge
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
|
||||
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
|
||||
-g java \
|
||||
-t modules/openapi-generator/src/main/resources/Java \
|
||||
--additional-properties artifactId=petstore-okhttp-gson,hideGenerationTimestamp:true \
|
||||
-o samples/client/petstore/java/okhttp-gson
|
||||
```
|
||||
|
||||
@@ -526,13 +528,7 @@ cd samples/client/petstore/java/okhttp-gson
|
||||
mvn package
|
||||
```
|
||||
|
||||
Other languages have petstore samples, too:
|
||||
|
||||
- [Swift5](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift5)
|
||||
- [Ruby](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/ruby)
|
||||
- [Kotlin](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/kotlin)
|
||||
|
||||
... and more.
|
||||
Other generators have [samples](https://github.com/OpenAPITools/openapi-generator/tree/master/samples) too.
|
||||
|
||||
### [3.1 - Customization](#table-of-contents)
|
||||
|
||||
@@ -808,6 +804,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2020-10-31 - [[B2] OpenAPI Specification으로 타입-세이프하게 API 개발하기: 희망편 VS 절망편](https://www.youtube.com/watch?v=J4JHLESAiFk) by 최태건 at [FEConf 2020](https://2020.feconf.kr/)
|
||||
- 2020-11-05 - [Automated REST-Api Code Generation: Wie IT-Systeme miteinander sprechen](https://www.massiveart.com/blog/automated-rest-api-code-generation-wie-it-systeme-miteinander-sprechen) by Stefan Rottensteiner at [MASSIVE ART Blog](https://www.massiveart.com/blog)
|
||||
- 2020-12-01 - [OpenAPI GeneratorでGoのAPIサーバー/クライアントコードを自動生成する](https://qiita.com/saki-engineering/items/b20d8b6074c4da9664a5) by [@saki-engineering](https://qiita.com/saki-engineering)
|
||||
- 2020-12-04 - [Scaling the Test Coverage of OpenAPI Generator for 30+ Programming Languages](https://www.youtube.com/watch?v=7Lke9dHRqT0) by [William Cheng](https://github.com/wing328) at [Open Source Summit Japan + Automotive Linux Summit 2020](https://events.linuxfoundation.org/archive/2020/open-source-summit-japan/) ([Slides](https://speakerdeck.com/wing328/scaling-the-test-coverage-of-openapi-generator-for-30-plus-programming-languages))
|
||||
- 2020-12-09 - [プロジェクトにOpenAPI Generatorで自動生成された型付きAPI Clientを導入した話](https://qiita.com/yoshifujiT/items/905c18700ede23f40840) by [@yoshifujiT](https://github.com/yoshifujiT)
|
||||
- 2020-12-15 - [Next.js + NestJS + GraphQLで変化に追従するフロントエンドへ 〜 ショッピングクーポンの事例紹介](https://techblog.yahoo.co.jp/entry/2020121530052952/) by [小倉 陸](https://github.com/ogugu9) at [Yahoo! JAPAN Tech Blog](https://techblog.yahoo.co.jp/)
|
||||
- 2021-01-08 - [Hello, New API – Part 1](https://www.nginx.com/blog/hello-new-api-part-1/) by [Jeremy Schulman](https://www.nginx.com/people/jeremy-schulman/) at [Major League Baseball](https://www.mlb.com)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
generatorName: typescript-nestjs
|
||||
outputDir: samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-nestjs
|
||||
additionalProperties:
|
||||
nestVersion: 6.0.0
|
||||
"npmName": "@openapitools/typescript-nestjs-petstore"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# csharp-netcore test files and image for upload
|
||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
|
||||
sha256: b74ef9eefa4b41fd3233e083fe2355babf25a77f9073d28e1aa81ae2e0a5f1d0
|
||||
sha256: aceebba316148a2a803a15ef4e13bbd0b0a1b8d15006cd88adb9b39a620ee451
|
||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"
|
||||
sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230
|
||||
|
||||
@@ -21,7 +21,7 @@ Our tooling supports the following types of configuration:
|
||||
|
||||
## Tool-specific Declarations
|
||||
|
||||
The READMEs for the [CLI](https://openapi-generator.tech/docs/usage#generate), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), and [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md) may have top-level or tooling specific options which appear to duplicate 'config options' or 'global properties'. Each may also expose user-facing properties slightly differently from the other tools. This may occur due to:
|
||||
The READMEs for the [CLI](https://openapi-generator.tech/docs/usage#generate), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), and [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md) may have top-level or tooling specific options which appear to duplicate 'config options' or 'global properties'. Each may also expose user-facing properties slightly differently from the other tools. This may occur due to:
|
||||
|
||||
* Conventions used by the underlying tooling
|
||||
* Limitations in underlying frameworks which define how properties must be declared
|
||||
|
||||
@@ -94,7 +94,7 @@ The following generators are available:
|
||||
* [java-pkmst](generators/java-pkmst.md)
|
||||
* [java-play-framework](generators/java-play-framework.md)
|
||||
* [java-undertow-server](generators/java-undertow-server.md)
|
||||
* [java-vertx](generators/java-vertx.md)
|
||||
* [java-vertx (deprecated)](generators/java-vertx.md)
|
||||
* [java-vertx-web (beta)](generators/java-vertx-web.md)
|
||||
* [jaxrs-cxf](generators/jaxrs-cxf.md)
|
||||
* [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md)
|
||||
|
||||
@@ -41,8 +41,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|List|
|
||||
|map|Map|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
@@ -36,8 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|List|
|
||||
|map|Map|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
@@ -34,8 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|List|
|
||||
|map|Map|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
@@ -32,8 +32,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|BigDecimal|java.math.BigDecimal|
|
||||
|Date|java.util.Date|
|
||||
|DateTime|java.time.LocalDateTime|
|
||||
|Date|java.time.LocalDate|
|
||||
|DateTime|java.time.OffsetDateTime|
|
||||
|File|java.io.File|
|
||||
|LocalDate|java.time.LocalDate|
|
||||
|LocalDateTime|java.time.LocalDateTime|
|
||||
|
||||
@@ -26,8 +26,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|BigDecimal|java.math.BigDecimal|
|
||||
|Date|java.util.Date|
|
||||
|DateTime|java.time.LocalDateTime|
|
||||
|Date|java.time.LocalDate|
|
||||
|DateTime|java.time.OffsetDateTime|
|
||||
|File|java.io.File|
|
||||
|LocalDate|java.time.LocalDate|
|
||||
|LocalDateTime|java.time.LocalDateTime|
|
||||
|
||||
@@ -34,8 +34,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|BigDecimal|java.math.BigDecimal|
|
||||
|Date|java.util.Date|
|
||||
|DateTime|java.time.LocalDateTime|
|
||||
|Date|java.time.LocalDate|
|
||||
|DateTime|java.time.OffsetDateTime|
|
||||
|File|java.io.File|
|
||||
|LocalDate|java.time.LocalDate|
|
||||
|LocalDateTime|java.time.LocalDateTime|
|
||||
|
||||
@@ -27,8 +27,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|BigDecimal|java.math.BigDecimal|
|
||||
|Date|java.util.Date|
|
||||
|DateTime|java.time.LocalDateTime|
|
||||
|Date|java.time.LocalDate|
|
||||
|DateTime|java.time.OffsetDateTime|
|
||||
|File|java.io.File|
|
||||
|LocalDate|java.time.LocalDate|
|
||||
|LocalDateTime|java.time.LocalDateTime|
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=5.1.0-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("ByteArray", "kotlin.ByteArray");
|
||||
typeMapping.put("number", "java.math.BigDecimal");
|
||||
typeMapping.put("decimal", "java.math.BigDecimal");
|
||||
typeMapping.put("date-time", "java.time.LocalDateTime");
|
||||
typeMapping.put("date-time", "java.time.OffsetDateTime");
|
||||
typeMapping.put("date", "java.time.LocalDate");
|
||||
typeMapping.put("file", "java.io.File");
|
||||
typeMapping.put("array", "kotlin.Array");
|
||||
@@ -163,7 +163,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("object", "kotlin.Any");
|
||||
typeMapping.put("binary", "kotlin.ByteArray");
|
||||
typeMapping.put("Date", "java.time.LocalDate");
|
||||
typeMapping.put("DateTime", "java.time.LocalDateTime");
|
||||
typeMapping.put("DateTime", "java.time.OffsetDateTime");
|
||||
|
||||
instantiationTypes.put("array", "kotlin.collections.ArrayList");
|
||||
instantiationTypes.put("list", "kotlin.collections.ArrayList");
|
||||
@@ -174,9 +174,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
importMapping.put("UUID", "java.util.UUID");
|
||||
importMapping.put("URI", "java.net.URI");
|
||||
importMapping.put("File", "java.io.File");
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
importMapping.put("Date", "java.time.LocalDate");
|
||||
importMapping.put("Timestamp", "java.sql.Timestamp");
|
||||
importMapping.put("DateTime", "java.time.LocalDateTime");
|
||||
importMapping.put("DateTime", "java.time.OffsetDateTime");
|
||||
importMapping.put("LocalDateTime", "java.time.LocalDateTime");
|
||||
importMapping.put("LocalDate", "java.time.LocalDate");
|
||||
importMapping.put("LocalTime", "java.time.LocalTime");
|
||||
|
||||
@@ -141,14 +141,13 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
"double",
|
||||
"dynamic"
|
||||
);
|
||||
instantiationTypes.put("array", "List");
|
||||
instantiationTypes.put("map", "Map");
|
||||
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("Array", "List");
|
||||
typeMapping.put("array", "List");
|
||||
typeMapping.put("map", "Map");
|
||||
typeMapping.put("List", "List");
|
||||
typeMapping.put("set", "Set");
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("char", "String");
|
||||
@@ -468,9 +467,10 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
if (ModelUtils.isMapSchema(schema) || ModelUtils.isSet(schema)) {
|
||||
return "const {}";
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
}
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
return "const []";
|
||||
}
|
||||
|
||||
@@ -494,7 +494,8 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
if (ModelUtils.isArraySchema(target)) {
|
||||
Schema<?> items = getSchemaItems((ArraySchema) schema);
|
||||
return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">";
|
||||
} else if (ModelUtils.isMapSchema(target)) {
|
||||
}
|
||||
if (ModelUtils.isMapSchema(target)) {
|
||||
// Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines
|
||||
// additionalproperties: true
|
||||
Schema<?> inner = getAdditionalProperties(target);
|
||||
|
||||
@@ -127,6 +127,9 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
public String toDefaultValue(Schema schema) {
|
||||
if (schema.getDefault() != null) {
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
if (ModelUtils.isSet(schema)) {
|
||||
return "SetBuilder()";
|
||||
}
|
||||
return "ListBuilder()";
|
||||
}
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
@@ -318,6 +321,7 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
if (param.isContainer) {
|
||||
final Map<String, Object> serializer = new HashMap<>();
|
||||
serializer.put("isArray", param.isArray);
|
||||
serializer.put("uniqueItems", param.uniqueItems);
|
||||
serializer.put("isMap", param.isMap);
|
||||
serializer.put("baseType", param.baseType);
|
||||
serializers.add(serializer);
|
||||
@@ -347,7 +351,8 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
|
||||
if (op.returnContainer != null) {
|
||||
final Map<String, Object> serializer = new HashMap<>();
|
||||
serializer.put("isArray", Objects.equals("array", op.returnContainer));
|
||||
serializer.put("isArray", Objects.equals("array", op.returnContainer) || Objects.equals("set", op.returnContainer));
|
||||
serializer.put("uniqueItems", op.uniqueItems);
|
||||
serializer.put("isMap", Objects.equals("map", op.returnContainer));
|
||||
serializer.put("baseType", op.returnBaseType);
|
||||
serializers.add(serializer);
|
||||
|
||||
@@ -24,9 +24,14 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
@@ -37,6 +42,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaVertXServerCodegen.class);
|
||||
|
||||
protected String resourceFolder = "src/main/resources";
|
||||
protected String rootPackage = "org.openapitools.server.api";
|
||||
@@ -61,6 +67,10 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
|
||||
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.DEPRECATED)
|
||||
.build();
|
||||
|
||||
// set the output folder here
|
||||
outputFolder = "generated-code" + File.separator + "javaVertXServer";
|
||||
|
||||
@@ -134,6 +144,8 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
LOGGER.warn("IMPORTANT: This generator has been deprecated. Please use `java-vertx-web` instead");
|
||||
|
||||
apiTestTemplateFiles.clear();
|
||||
|
||||
importMapping.remove("JsonCreator");
|
||||
|
||||
@@ -125,17 +125,9 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
typeMapping.put("array", "kotlin.collections.List");
|
||||
typeMapping.put("list", "kotlin.collections.List");
|
||||
|
||||
typeMapping.put("date", "java.time.LocalDate");
|
||||
typeMapping.put("date-time", "java.time.OffsetDateTime");
|
||||
typeMapping.put("Date", "java.time.LocalDate");
|
||||
typeMapping.put("DateTime", "java.time.OffsetDateTime");
|
||||
|
||||
// use resource for file handling
|
||||
typeMapping.put("file", "org.springframework.core.io.Resource");
|
||||
|
||||
importMapping.put("Date", "java.time.LocalDate");
|
||||
importMapping.put("DateTime", "java.time.OffsetDateTime");
|
||||
|
||||
addOption(TITLE, "server title name or client service name", title);
|
||||
addOption(BASE_PACKAGE, "base package (invokerPackage) for generated code", basePackage);
|
||||
addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort);
|
||||
|
||||
@@ -330,16 +330,16 @@
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.4</gson-fire-version>
|
||||
<swagger-core-version>1.5.24</swagger-core-version>
|
||||
<okhttp-version>3.14.7</okhttp-version>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.10</commons-lang3-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
<jodatime-version>2.10.9</jodatime-version>
|
||||
{{/joda}}
|
||||
{{#threetenbp}}
|
||||
<threetenbp-version>1.4.3</threetenbp-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
{{/threetenbp}}
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
|
||||
@@ -472,6 +472,19 @@ namespace {{packageName}}.Client
|
||||
response = client.Execute<T>(req);
|
||||
}
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
var result = ToApiResponse(response);
|
||||
@@ -583,6 +596,10 @@ namespace {{packageName}}.Client
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@ import 'package:built_value/serializer.dart';
|
||||
{{/fullImports}}
|
||||
|
||||
class {{classname}} {
|
||||
final Dio _dio;
|
||||
Serializers _serializers;
|
||||
|
||||
{{classname}}(this._dio, this._serializers);
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const {{classname}}(this._dio, this._serializers);
|
||||
|
||||
{{#operation}}
|
||||
/// {{{summary}}}
|
||||
@@ -69,7 +71,7 @@ class {{classname}} {
|
||||
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
const type = FullType(BuiltList, [FullType({{baseType}})]);
|
||||
const type = FullType(Built{{#uniqueItems}}Built{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}, [FullType({{baseType}})]);
|
||||
final serializedBody = _serializers.serialize({{paramName}}, specifiedType: type);
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
@@ -135,8 +137,7 @@ class {{classname}} {
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{/returnSimpleType}}
|
||||
{{^returnSimpleType}}
|
||||
const collectionType = {{#isMap}}BuiltMap{{/isMap}}{{^isMap}}BuiltList{{/isMap}};
|
||||
const type = FullType(collectionType, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]);
|
||||
const type = FullType(Built{{#isMap}}Map{{/isMap}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]);
|
||||
final data = _serializers.deserialize(
|
||||
response.data is String
|
||||
? jsonDecode(response.data as String)
|
||||
@@ -149,6 +150,7 @@ class {{classname}} {
|
||||
return Response<{{{returnType}}}>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
|
||||
@@ -10,31 +10,37 @@ import 'package:{{pubName}}/auth/oauth.dart';
|
||||
{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart';
|
||||
{{/apis}}{{/apiInfo}}
|
||||
|
||||
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
|
||||
final _defaultInterceptors = [
|
||||
OAuthInterceptor(),
|
||||
BasicAuthInterceptor(),
|
||||
ApiKeyAuthInterceptor(),
|
||||
];
|
||||
|
||||
class {{clientName}} {
|
||||
|
||||
Dio dio;
|
||||
Serializers serializers;
|
||||
String basePath = '{{{basePath}}}';
|
||||
static const String basePath = r'{{{basePath}}}';
|
||||
|
||||
{{clientName}}({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
|
||||
if (dio == null) {
|
||||
BaseOptions options = new BaseOptions(
|
||||
final Dio dio;
|
||||
|
||||
final Serializers serializers;
|
||||
|
||||
{{clientName}}({
|
||||
Dio dio,
|
||||
Serializers serializers,
|
||||
String basePathOverride,
|
||||
List<Interceptor> interceptors,
|
||||
}) : this.serializers = serializers ?? standardSerializers,
|
||||
this.dio = dio ??
|
||||
Dio(BaseOptions(
|
||||
baseUrl: basePathOverride ?? basePath,
|
||||
connectTimeout: 5000,
|
||||
receiveTimeout: 3000,
|
||||
);
|
||||
this.dio = new Dio(options);
|
||||
}
|
||||
|
||||
)) {
|
||||
if (interceptors == null) {
|
||||
this.dio.interceptors.addAll(_defaultInterceptors);
|
||||
} else {
|
||||
this.dio.interceptors.addAll(interceptors);
|
||||
}
|
||||
|
||||
this.serializers = serializers ?? standardSerializers;
|
||||
}
|
||||
|
||||
void setOAuthToken(String name, String token) {
|
||||
|
||||
@@ -4,6 +4,9 @@ import 'package:built_value/serializer.dart';
|
||||
import 'package:time_machine/time_machine.dart';
|
||||
|
||||
class OffsetDateSerializer implements PrimitiveSerializer<OffsetDate> {
|
||||
|
||||
const OffsetDateSerializer();
|
||||
|
||||
@override
|
||||
Iterable<Type> get types => BuiltList<Type>([OffsetDate]);
|
||||
|
||||
@@ -25,6 +28,9 @@ class OffsetDateSerializer implements PrimitiveSerializer<OffsetDate> {
|
||||
}
|
||||
|
||||
class OffsetDateTimeSerializer implements PrimitiveSerializer<OffsetDateTime> {
|
||||
|
||||
const OffsetDateTimeSerializer();
|
||||
|
||||
@override
|
||||
Iterable<Type> get types => BuiltList<Type>([OffsetDateTime]);
|
||||
|
||||
|
||||
@@ -18,16 +18,16 @@ part 'serializers.g.dart';
|
||||
Serializers serializers = (_$serializers.toBuilder(){{#apiInfo}}{{#apis}}{{#serializers}}
|
||||
..addBuilderFactory(
|
||||
{{#isArray}}
|
||||
const FullType(BuiltList, [FullType({{baseType}})]),
|
||||
() => ListBuilder<{{baseType}}>(),
|
||||
const FullType(Built{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}, [FullType({{baseType}})]),
|
||||
() => {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}Builder<{{baseType}}>(),
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
const FullType(BuiltMap, [FullType(String), FullType({{baseType}})]),
|
||||
() => MapBuilder<String, {{baseType}}>(),
|
||||
{{/isMap}}
|
||||
){{/serializers}}{{/apis}}{{/apiInfo}}{{#timeMachine}}
|
||||
..add(OffsetDateSerializer())
|
||||
..add(OffsetDateTimeSerializer()){{/timeMachine}}
|
||||
..add(const OffsetDateSerializer())
|
||||
..add(const OffsetDateTimeSerializer()){{/timeMachine}}
|
||||
..add(Iso8601DateTimeSerializer()))
|
||||
.build();
|
||||
|
||||
|
||||
@@ -187,8 +187,8 @@ class {{{classname}}} {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
{{#isArray}}
|
||||
return (apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as List)
|
||||
.map((item) => item as {{{returnBaseType}}})
|
||||
.toList(growable: false);
|
||||
.cast<{{{returnBaseType}}}>()
|
||||
.{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}};
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#isMap}}
|
||||
|
||||
@@ -194,6 +194,12 @@ class ApiClient {
|
||||
.map((v) => _deserialize(v, newTargetType, growable: growable))
|
||||
.toList(growable: true == growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
|
||||
final newTargetType = match[1];
|
||||
return value
|
||||
.map((v) => _deserialize(v, newTargetType, growable: growable))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||
final newTargetType = match[1];
|
||||
return Map.fromIterables(
|
||||
|
||||
@@ -26,6 +26,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
||||
const _dateEpochMarker = 'epoch';
|
||||
final _dateFormatter = DateFormat('yyyy-MM-dd');
|
||||
final _regList = RegExp(r'^List<(.*)>$');
|
||||
final _regSet = RegExp(r'^Set<(.*)>$');
|
||||
final _regMap = RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient defaultApiClient = ApiClient();
|
||||
|
||||
@@ -156,7 +156,7 @@ class {{{classname}}} {
|
||||
{{^isEnum}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
: (json[r'{{{baseName}}}'] as List).cast<{{{items.datatype}}}>(),
|
||||
: (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>(),
|
||||
{{/isEnum}}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
|
||||
@@ -116,6 +116,11 @@ type HttpSignatureAuth struct {
|
||||
privateKey crypto.PrivateKey // The private key used to sign HTTP requests.
|
||||
}
|
||||
|
||||
// SetPrivateKey accepts a private key string and sets it.
|
||||
func (h *HttpSignatureAuth) SetPrivateKey(privateKey string) error {
|
||||
return h.parsePrivateKey([]byte(privateKey))
|
||||
}
|
||||
|
||||
// ContextWithValue validates the HttpSignatureAuth configuration parameters and returns a context
|
||||
// suitable for HTTP signature. An error is returned if the HttpSignatureAuth configuration parameters
|
||||
// are invalid.
|
||||
@@ -123,7 +128,7 @@ func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Conte
|
||||
if h.KeyId == "" {
|
||||
return nil, fmt.Errorf("Key ID must be specified")
|
||||
}
|
||||
if h.PrivateKeyPath == "" {
|
||||
if h.PrivateKeyPath == "" && h.privateKey == nil {
|
||||
return nil, fmt.Errorf("Private key path must be specified")
|
||||
}
|
||||
if _, ok := supportedSigningSchemes[h.SigningScheme]; !ok {
|
||||
@@ -168,7 +173,11 @@ func (h *HttpSignatureAuth) GetPublicKey() (crypto.PublicKey, error) {
|
||||
}
|
||||
|
||||
// loadPrivateKey reads the private key from the file specified in the HttpSignatureAuth.
|
||||
// The key is loaded only when privateKey is not already set.
|
||||
func (h *HttpSignatureAuth) loadPrivateKey() (err error) {
|
||||
if h.privateKey != nil {
|
||||
return nil
|
||||
}
|
||||
var file *os.File
|
||||
file, err = os.Open(h.PrivateKeyPath)
|
||||
if err != nil {
|
||||
@@ -182,12 +191,18 @@ func (h *HttpSignatureAuth) loadPrivateKey() (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return h.parsePrivateKey(priv)
|
||||
}
|
||||
|
||||
// parsePrivateKey decodes privateKey byte array to crypto.PrivateKey type.
|
||||
func (h *HttpSignatureAuth) parsePrivateKey(priv []byte) error {
|
||||
pemBlock, _ := pem.Decode(priv)
|
||||
if pemBlock == nil {
|
||||
// No PEM data has been found.
|
||||
return fmt.Errorf("File '%s' does not contain PEM data", h.PrivateKeyPath)
|
||||
}
|
||||
var privKey []byte
|
||||
var err error
|
||||
if x509.IsEncryptedPEMBlock(pemBlock) {
|
||||
// The PEM data is encrypted.
|
||||
privKey, err = x509.DecryptPEMBlock(pemBlock, []byte(h.Passphrase))
|
||||
|
||||
@@ -2,7 +2,6 @@ package {{packageName}}.infrastructure
|
||||
|
||||
{{#moshi}}
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
{{^moshiCodeGen}}
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
{{/moshiCodeGen}}
|
||||
@@ -36,7 +35,6 @@ import java.util.Date
|
||||
{{#moshi}}
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
@@ -54,7 +52,6 @@ import java.util.Date
|
||||
{{#gson}}
|
||||
@JvmStatic
|
||||
val gsonBuilder: GsonBuilder = GsonBuilder()
|
||||
.registerTypeAdapter(Date::class.java, DateAdapter())
|
||||
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
||||
|
||||
@@ -23,8 +23,6 @@ Method | HTTP request | Description
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name {{{packageName}}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
|
||||
@@ -163,6 +163,7 @@ conf = {{{packageName}}}.Configuration(
|
||||
|
||||
def __init__(self, host=None,
|
||||
api_key=None, api_key_prefix=None,
|
||||
access_token=None,
|
||||
username=None, password=None,
|
||||
discard_unknown_keys=False,
|
||||
disabled_client_side_validations="",
|
||||
@@ -190,6 +191,7 @@ conf = {{{packageName}}}.Configuration(
|
||||
"""Temp file folder for downloading files
|
||||
"""
|
||||
# Authentication Settings
|
||||
self.access_token = access_token
|
||||
self.api_key = {}
|
||||
if api_key:
|
||||
self.api_key = api_key
|
||||
@@ -218,18 +220,6 @@ conf = {{{packageName}}}.Configuration(
|
||||
"""The HTTP signing configuration
|
||||
"""
|
||||
{{/hasHttpSignatureMethods}}
|
||||
{{#hasOAuthMethods}}
|
||||
self.access_token = None
|
||||
"""access token for OAuth/Bearer
|
||||
"""
|
||||
{{/hasOAuthMethods}}
|
||||
{{^hasOAuthMethods}}
|
||||
{{#hasBearerMethods}}
|
||||
self.access_token = None
|
||||
"""access token for OAuth/Bearer
|
||||
"""
|
||||
{{/hasBearerMethods}}
|
||||
{{/hasOAuthMethods}}
|
||||
self.logger = {}
|
||||
"""Logging Settings
|
||||
"""
|
||||
|
||||
@@ -283,7 +283,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
{{^supportMultipleResponses}}
|
||||
{{^returnType}}
|
||||
Ok(())
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use reqwest;
|
||||
use serde_json;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ export class {{classname}} {
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
if ({{paramName}} !== undefined && {{paramName}} !== null) {
|
||||
headers['{{baseName}}'] String({{paramName}});
|
||||
headers['{{baseName}}'] = String({{paramName}});
|
||||
}
|
||||
{{/isListContainer}}
|
||||
{{/headerParams}}
|
||||
@@ -147,7 +147,7 @@ export class {{classname}} {
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
{{#produces}}
|
||||
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
|
||||
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
||||
{{/produces}}
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -158,7 +158,7 @@ export class {{classname}} {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
{{#consumes}}
|
||||
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
|
||||
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
||||
{{/consumes}}
|
||||
];
|
||||
{{#bodyParam}}
|
||||
@@ -167,8 +167,8 @@ export class {{classname}} {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
{{/bodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let formParams: { append(param: string, value: any): void; };
|
||||
@@ -176,6 +176,7 @@ export class {{classname}} {
|
||||
let convertFormParamsToString = false;
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
|
||||
// use FormData to transmit files using content-type "multipart/form-data"
|
||||
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
|
||||
useForm = canConsumeForm;
|
||||
@@ -186,8 +187,8 @@ export class {{classname}} {
|
||||
} else {
|
||||
// formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
|
||||
}
|
||||
|
||||
{{#formParams}}
|
||||
|
||||
{{#isListContainer}}
|
||||
if ({{paramName}}) {
|
||||
{{#isCollectionFormatMulti}}
|
||||
|
||||
@@ -142,6 +142,45 @@ public class DartModelTest {
|
||||
Assert.assertTrue(property2.isContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with set property")
|
||||
public void setPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
.addProperties("id", new IntegerSchema())
|
||||
.addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true))
|
||||
.addRequiredItem("id");
|
||||
|
||||
final DefaultCodegen codegen = new DartClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
|
||||
Assert.assertEquals(cm.name, "sample");
|
||||
Assert.assertEquals(cm.classname, "Sample");
|
||||
Assert.assertEquals(cm.description, "a sample model");
|
||||
Assert.assertEquals(cm.vars.size(), 2);
|
||||
|
||||
final CodegenProperty property1 = cm.vars.get(0);
|
||||
Assert.assertEquals(property1.baseName, "id");
|
||||
Assert.assertEquals(property1.dataType, "int");
|
||||
Assert.assertEquals(property1.name, "id");
|
||||
Assert.assertNull(property1.defaultValue);
|
||||
Assert.assertEquals(property1.baseType, "int");
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertFalse(property1.isContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
Assert.assertEquals(property2.dataType, "Set<String>");
|
||||
Assert.assertEquals(property2.name, "urls");
|
||||
Assert.assertEquals(property2.baseType, "Set");
|
||||
Assert.assertEquals(property2.containerType, "set");
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with a map property")
|
||||
public void mapPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
|
||||
@@ -204,6 +204,44 @@ public class DartDioModelTest {
|
||||
Assert.assertTrue(property2.isContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with set property")
|
||||
public void setPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
.addProperties("id", new IntegerSchema())
|
||||
.addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true))
|
||||
.addRequiredItem("id");
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
|
||||
Assert.assertEquals(cm.name, "sample");
|
||||
Assert.assertEquals(cm.classname, "Sample");
|
||||
Assert.assertEquals(cm.description, "a sample model");
|
||||
Assert.assertEquals(cm.vars.size(), 2);
|
||||
|
||||
final CodegenProperty property1 = cm.vars.get(0);
|
||||
Assert.assertEquals(property1.baseName, "id");
|
||||
Assert.assertEquals(property1.dataType, "int");
|
||||
Assert.assertEquals(property1.name, "id");
|
||||
Assert.assertNull(property1.defaultValue);
|
||||
Assert.assertEquals(property1.baseType, "int");
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertFalse(property1.isContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
Assert.assertEquals(property2.dataType, "BuiltSet<String>");
|
||||
Assert.assertEquals(property2.name, "urls");
|
||||
Assert.assertEquals(property2.baseType, "BuiltSet");
|
||||
Assert.assertEquals(property2.containerType, "set");
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with a map property")
|
||||
public void mapPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
|
||||
@@ -134,6 +134,7 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
uniqueItems: true
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
@@ -143,11 +144,13 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
uniqueItems: true
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
uniqueItems: true
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
@@ -1313,6 +1316,7 @@ components:
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
uniqueItems: true
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
|
||||
7
pom.xml
7
pom.xml
@@ -1181,6 +1181,8 @@
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/client/petstore/typescript-axios/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-axios/tests/default</module>
|
||||
<module>samples/client/petstore/crystal</module>
|
||||
<!-- servers -->
|
||||
<module>samples/server/petstore/python-aiohttp</module>
|
||||
@@ -1222,7 +1224,6 @@
|
||||
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
|
||||
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-fetch/tests/default</module>
|
||||
<module>samples/client/petstore/typescript-axios/tests/default</module>
|
||||
<module>samples/client/petstore/typescript-node/npm</module>
|
||||
<module>samples/client/petstore/typescript-rxjs/builds/with-npm-version</module>
|
||||
<!-- TODO comment out below when the test for typescript-nestjs is ready
|
||||
@@ -1259,8 +1260,7 @@
|
||||
<module>samples/server/petstore/jaxrs-spec</module>
|
||||
<module>samples/server/petstore/jaxrs-spec-interface</module>
|
||||
<module>samples/server/petstore/jaxrs-spec-interface-response</module>
|
||||
<module>samples/server/petstore/java-vertx/rx</module>
|
||||
<module>samples/server/petstore/java-vertx/async</module>
|
||||
<module>samples/server/petstore/java-vertx-web</module>
|
||||
<module>samples/server/petstore/java-inflector</module>
|
||||
<module>samples/server/petstore/java-pkmst</module>
|
||||
<module>samples/server/petstore/java-play-framework</module>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<module>samples/server/petstore/scala-play-server</module>
|
||||
<module>samples/server/petstore/scala-akka-http-server</module>
|
||||
<module>samples/server/petstore/scalatra</module>
|
||||
<module>samples/server/petstore/java-vertx-web</module>
|
||||
<module>samples/server/petstore/scala-finch</module>
|
||||
<!--<module>samples/server/petstore/kotlin/vertx</module>-->
|
||||
</modules>
|
||||
|
||||
@@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client
|
||||
response = client.Execute<T>(req);
|
||||
}
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
var result = ToApiResponse(response);
|
||||
@@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
|
||||
@@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client
|
||||
response = client.Execute<T>(req);
|
||||
}
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
var result = ToApiResponse(response);
|
||||
@@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
|
||||
@@ -199,6 +199,19 @@ namespace Org.OpenAPITools.Test
|
||||
Assert.Equal("sample category name2", response.Category.Name);
|
||||
}
|
||||
|
||||
/* a simple test for binary response. no longer in use.
|
||||
[Fact]
|
||||
public void TestGetByIdBinaryResponse()
|
||||
{
|
||||
PetApi petApi = new PetApi(c1);
|
||||
Stream response = petApi.GetPetByIdBinaryResponse(petId);
|
||||
Assert.IsType<System.IO.MemoryStream>(response);
|
||||
StreamReader reader = new StreamReader(response);
|
||||
// the following will fail for sure
|
||||
//Assert.Equal("someting", reader.ReadToEnd());
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Test GetPetByIdWithHttpInfoAsync
|
||||
/// </summary>
|
||||
|
||||
@@ -476,6 +476,19 @@ namespace Org.OpenAPITools.Client
|
||||
response = client.Execute<T>(req);
|
||||
}
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
var result = ToApiResponse(response);
|
||||
@@ -586,6 +599,10 @@ namespace Org.OpenAPITools.Client
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
|
||||
@@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client
|
||||
response = client.Execute<T>(req);
|
||||
}
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
T instance = (T)Activator.CreateInstance(typeof(T));
|
||||
MethodInfo method = typeof(T).GetMethod("FromJson");
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
var result = ToApiResponse(response);
|
||||
@@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client
|
||||
method.Invoke(instance, new object[] { response.Content });
|
||||
response.Data = instance;
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
response.Data = (T)(object)new MemoryStream(response.RawBytes);
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
|
||||
@@ -250,6 +250,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,31 +18,37 @@ import 'package:openapi/api/store_api.dart';
|
||||
import 'package:openapi/api/user_api.dart';
|
||||
|
||||
|
||||
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
|
||||
final _defaultInterceptors = [
|
||||
OAuthInterceptor(),
|
||||
BasicAuthInterceptor(),
|
||||
ApiKeyAuthInterceptor(),
|
||||
];
|
||||
|
||||
class Openapi {
|
||||
|
||||
Dio dio;
|
||||
Serializers serializers;
|
||||
String basePath = 'http://petstore.swagger.io/v2';
|
||||
static const String basePath = r'http://petstore.swagger.io/v2';
|
||||
|
||||
Openapi({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
|
||||
if (dio == null) {
|
||||
BaseOptions options = new BaseOptions(
|
||||
final Dio dio;
|
||||
|
||||
final Serializers serializers;
|
||||
|
||||
Openapi({
|
||||
Dio dio,
|
||||
Serializers serializers,
|
||||
String basePathOverride,
|
||||
List<Interceptor> interceptors,
|
||||
}) : this.serializers = serializers ?? standardSerializers,
|
||||
this.dio = dio ??
|
||||
Dio(BaseOptions(
|
||||
baseUrl: basePathOverride ?? basePath,
|
||||
connectTimeout: 5000,
|
||||
receiveTimeout: 3000,
|
||||
);
|
||||
this.dio = new Dio(options);
|
||||
}
|
||||
|
||||
)) {
|
||||
if (interceptors == null) {
|
||||
this.dio.interceptors.addAll(_defaultInterceptors);
|
||||
} else {
|
||||
this.dio.interceptors.addAll(interceptors);
|
||||
}
|
||||
|
||||
this.serializers = serializers ?? standardSerializers;
|
||||
}
|
||||
|
||||
void setOAuthToken(String name, String token) {
|
||||
|
||||
@@ -17,10 +17,12 @@ import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/api_util.dart';
|
||||
|
||||
class PetApi {
|
||||
final Dio _dio;
|
||||
Serializers _serializers;
|
||||
|
||||
PetApi(this._dio, this._serializers);
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const PetApi(this._dio, this._serializers);
|
||||
|
||||
/// Add a new pet to the store
|
||||
///
|
||||
@@ -181,8 +183,7 @@ class PetApi {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
const collectionType = BuiltList;
|
||||
const type = FullType(collectionType, [FullType(Pet)]);
|
||||
const type = FullType(BuiltList, [FullType(Pet)]);
|
||||
final data = _serializers.deserialize(
|
||||
response.data is String
|
||||
? jsonDecode(response.data as String)
|
||||
@@ -193,6 +194,7 @@ class PetApi {
|
||||
return Response<BuiltList<Pet>>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -251,8 +253,7 @@ class PetApi {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
const collectionType = BuiltList;
|
||||
const type = FullType(collectionType, [FullType(Pet)]);
|
||||
const type = FullType(BuiltList, [FullType(Pet)]);
|
||||
final data = _serializers.deserialize(
|
||||
response.data is String
|
||||
? jsonDecode(response.data as String)
|
||||
@@ -263,6 +264,7 @@ class PetApi {
|
||||
return Response<BuiltList<Pet>>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -331,6 +333,7 @@ class PetApi {
|
||||
return Response<Pet>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -525,6 +528,7 @@ class PetApi {
|
||||
return Response<ApiResponse>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
|
||||
@@ -14,10 +14,12 @@ import 'package:openapi/model/order.dart';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
|
||||
class StoreApi {
|
||||
final Dio _dio;
|
||||
Serializers _serializers;
|
||||
|
||||
StoreApi(this._dio, this._serializers);
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const StoreApi(this._dio, this._serializers);
|
||||
|
||||
/// Delete purchase order by ID
|
||||
///
|
||||
@@ -113,8 +115,7 @@ class StoreApi {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
const collectionType = BuiltMap;
|
||||
const type = FullType(collectionType, [FullType(String), FullType(int)]);
|
||||
const type = FullType(BuiltMap, [FullType(String), FullType(int)]);
|
||||
final data = _serializers.deserialize(
|
||||
response.data is String
|
||||
? jsonDecode(response.data as String)
|
||||
@@ -125,6 +126,7 @@ class StoreApi {
|
||||
return Response<BuiltMap<String, int>>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -186,6 +188,7 @@ class StoreApi {
|
||||
return Response<Order>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -252,6 +255,7 @@ class StoreApi {
|
||||
return Response<Order>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
|
||||
@@ -14,10 +14,12 @@ import 'package:openapi/model/user.dart';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
|
||||
class UserApi {
|
||||
final Dio _dio;
|
||||
Serializers _serializers;
|
||||
|
||||
UserApi(this._dio, this._serializers);
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const UserApi(this._dio, this._serializers);
|
||||
|
||||
/// Create user
|
||||
///
|
||||
@@ -266,6 +268,7 @@ class UserApi {
|
||||
return Response<User>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
@@ -326,6 +329,7 @@ class UserApi {
|
||||
return Response<String>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
isRedirect: response.isRedirect,
|
||||
request: response.request,
|
||||
redirects: response.redirects,
|
||||
statusCode: response.statusCode,
|
||||
|
||||
@@ -41,6 +41,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
||||
const _dateEpochMarker = 'epoch';
|
||||
final _dateFormatter = DateFormat('yyyy-MM-dd');
|
||||
final _regList = RegExp(r'^List<(.*)>$');
|
||||
final _regSet = RegExp(r'^Set<(.*)>$');
|
||||
final _regMap = RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient defaultApiClient = ApiClient();
|
||||
|
||||
@@ -222,7 +222,7 @@ class PetApi {
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List)
|
||||
.map((item) => item as Pet)
|
||||
.cast<Pet>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return null;
|
||||
@@ -300,7 +300,7 @@ class PetApi {
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List)
|
||||
.map((item) => item as Pet)
|
||||
.cast<Pet>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -188,6 +188,12 @@ class ApiClient {
|
||||
.map((v) => _deserialize(v, newTargetType, growable: growable))
|
||||
.toList(growable: true == growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
|
||||
final newTargetType = match[1];
|
||||
return value
|
||||
.map((v) => _deserialize(v, newTargetType, growable: growable))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||
final newTargetType = match[1];
|
||||
return Map.fromIterables(
|
||||
|
||||
@@ -279,12 +279,12 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.4</gson-fire-version>
|
||||
<swagger-core-version>1.5.24</swagger-core-version>
|
||||
<okhttp-version>3.14.7</okhttp-version>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.10</commons-lang3-version>
|
||||
<threetenbp-version>1.4.3</threetenbp-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -281,12 +281,12 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.4</gson-fire-version>
|
||||
<swagger-core-version>1.5.24</swagger-core-version>
|
||||
<okhttp-version>3.14.7</okhttp-version>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.10</commons-lang3-version>
|
||||
<threetenbp-version>1.4.3</threetenbp-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -274,12 +274,12 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.4</gson-fire-version>
|
||||
<swagger-core-version>1.5.24</swagger-core-version>
|
||||
<okhttp-version>3.14.7</okhttp-version>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.10</commons-lang3-version>
|
||||
<threetenbp-version>1.4.3</threetenbp-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Date
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val gsonBuilder: GsonBuilder = GsonBuilder()
|
||||
.registerTypeAdapter(Date::class.java, DateAdapter())
|
||||
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Date
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val gsonBuilder: GsonBuilder = GsonBuilder()
|
||||
.registerTypeAdapter(Date::class.java, DateAdapter())
|
||||
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
||||
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
internal object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.0.0-SNAPSHOT
|
||||
5.0.1-SNAPSHOT
|
||||
@@ -33,6 +33,5 @@ dependencies {
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.9.2"
|
||||
compile "com.squareup.moshi:moshi-adapters:1.9.2"
|
||||
compile "com.squareup.okhttp3:okhttp:4.2.2"
|
||||
compile "com.squareup.okhttp3:logging-interceptor:4.4.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0"
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ val Response.isInformational : Boolean get() = this.code in 100..199
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 3xx code
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
||||
val Response.isRedirect : Boolean get() = this.code in 300..399
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import java.util.Date
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
|
||||
@@ -1055,6 +1055,7 @@ class PetApi
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$resourcePath = '/pet/findByTags';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
|
||||
@@ -362,6 +362,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
*/
|
||||
public function setPhotoUrls($photo_urls)
|
||||
{
|
||||
|
||||
|
||||
$this->container['photo_urls'] = $photo_urls;
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -23,8 +23,6 @@ Add a new pet to the store
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -72,8 +70,6 @@ Deletes a pet
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -124,8 +120,6 @@ Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -174,8 +168,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -224,8 +216,6 @@ Returns a single pet
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: api_key
|
||||
@@ -274,8 +264,6 @@ Update an existing pet
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -324,8 +312,6 @@ Updates a pet in the store with form data
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
@@ -378,8 +364,6 @@ uploads an image
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
|
||||
@@ -21,8 +21,6 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
$OrderId = "OrderId_example" # String | ID of the order that needs to be deleted
|
||||
|
||||
# Delete purchase order by ID
|
||||
@@ -65,8 +63,6 @@ Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: api_key
|
||||
@@ -113,8 +109,6 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
$OrderId = 987 # Int64 | ID of pet that needs to be fetched
|
||||
|
||||
# Find purchase order by ID
|
||||
@@ -156,8 +150,6 @@ Place an order for a pet
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
$Order = (Initialize-Order -Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "placed" -Complete $false) # Order | order placed for purchasing the pet
|
||||
|
||||
# Place an order for a pet
|
||||
|
||||
@@ -25,8 +25,6 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
@@ -75,8 +73,6 @@ Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
@@ -125,8 +121,6 @@ Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
@@ -177,8 +171,6 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
@@ -227,8 +219,6 @@ Get user by user name
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
$Username = "Username_example" # String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
# Get user by user name
|
||||
@@ -271,8 +261,6 @@ Logs user into the system
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
$Username = "Username_example" # String | The user name for login
|
||||
$Password = "Password_example" # String | The password for login in clear text
|
||||
|
||||
@@ -315,8 +303,6 @@ Logs out current logged in user session
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
@@ -364,8 +350,6 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```powershell
|
||||
Import-Module -Name PSPetstore
|
||||
|
||||
# general setting of the PowerShell module, e.g. base URL, authentication, etc
|
||||
$Configuration = Get-Configuration
|
||||
# Configure API key authorization: auth_cookie
|
||||
|
||||
@@ -118,6 +118,7 @@ conf = petstore_api.Configuration(
|
||||
|
||||
def __init__(self, host=None,
|
||||
api_key=None, api_key_prefix=None,
|
||||
access_token=None,
|
||||
username=None, password=None,
|
||||
discard_unknown_keys=False,
|
||||
disabled_client_side_validations="",
|
||||
@@ -142,6 +143,7 @@ conf = petstore_api.Configuration(
|
||||
"""Temp file folder for downloading files
|
||||
"""
|
||||
# Authentication Settings
|
||||
self.access_token = access_token
|
||||
self.api_key = {}
|
||||
if api_key:
|
||||
self.api_key = api_key
|
||||
@@ -163,9 +165,6 @@ conf = petstore_api.Configuration(
|
||||
"""
|
||||
self.discard_unknown_keys = discard_unknown_keys
|
||||
self.disabled_client_side_validations = disabled_client_side_validations
|
||||
self.access_token = None
|
||||
"""access token for OAuth/Bearer
|
||||
"""
|
||||
self.logger = {}
|
||||
"""Logging Settings
|
||||
"""
|
||||
|
||||
@@ -154,6 +154,16 @@ module Petstore
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] photo_urls Value to be assigned
|
||||
def photo_urls=(photo_urls)
|
||||
if photo_urls.nil?
|
||||
fail ArgumentError, 'photo_urls cannot be nil'
|
||||
end
|
||||
|
||||
@photo_urls = photo_urls
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] status Object to be assigned
|
||||
def status=(status)
|
||||
|
||||
@@ -154,6 +154,16 @@ module Petstore
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] photo_urls Value to be assigned
|
||||
def photo_urls=(photo_urls)
|
||||
if photo_urls.nil?
|
||||
fail ArgumentError, 'photo_urls cannot be nil'
|
||||
end
|
||||
|
||||
@photo_urls = photo_urls
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] status Object to be assigned
|
||||
def status=(status)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use reqwest;
|
||||
use serde_json;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<AddPetSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -269,7 +269,7 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<DeletePetSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -305,7 +305,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<FindPetsByStatusSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -341,7 +341,7 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<FindPetsByTagsSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -381,7 +381,7 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<GetPetByIdSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -416,7 +416,7 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<UpdatePetSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -460,7 +460,7 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration,
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<UpdatePetWithFormSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -502,7 +502,7 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<UploadFileSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
|
||||
@@ -122,7 +122,7 @@ pub async fn delete_order(configuration: &configuration::Configuration, params:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<DeleteOrderSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -161,7 +161,7 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<GetInventorySuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -193,7 +193,7 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<GetOrderByIdSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -225,7 +225,7 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<PlaceOrderSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
|
||||
@@ -216,7 +216,7 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<CreateUserSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -248,7 +248,7 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<CreateUsersWithArrayInputSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -280,7 +280,7 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<CreateUsersWithListInputSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -312,7 +312,7 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<DeleteUserSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -343,7 +343,7 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<GetUserByNameSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -377,7 +377,7 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<LoginUserSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -407,7 +407,7 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<LogoutUserSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
@@ -441,7 +441,7 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text().await?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
let local_var_entity: Option<UpdateUserSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use reqwest;
|
||||
use serde_json;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ pub fn add_pet(configuration: &configuration::Configuration, body: crate::models
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<AddPetError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -135,7 +135,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<DeletePetError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -166,7 +166,7 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<FindPetsByStatusError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -197,7 +197,7 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<FindPetsByTagsError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -232,7 +232,7 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64)
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetPetByIdError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -262,7 +262,7 @@ pub fn update_pet(configuration: &configuration::Configuration, body: crate::mod
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<UpdatePetError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -299,7 +299,7 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<UpdatePetWithFormError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -336,7 +336,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<UploadFileError> = serde_json::from_str(&local_var_content).ok();
|
||||
|
||||
@@ -67,7 +67,7 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<DeleteOrderError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -102,7 +102,7 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetInventoryError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -129,7 +129,7 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetOrderByIdError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -156,7 +156,7 @@ pub fn place_order(configuration: &configuration::Configuration, body: crate::mo
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<PlaceOrderError> = serde_json::from_str(&local_var_content).ok();
|
||||
|
||||
@@ -102,7 +102,7 @@ pub fn create_user(configuration: &configuration::Configuration, body: crate::mo
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<CreateUserError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -129,7 +129,7 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<CreateUsersWithArrayInputError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -156,7 +156,7 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<CreateUsersWithListInputError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -183,7 +183,7 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str)
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<DeleteUserError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -209,7 +209,7 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username:
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetUserByNameError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -237,7 +237,7 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str,
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<LoginUserError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -263,7 +263,7 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(),
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<LogoutUserError> = serde_json::from_str(&local_var_content).ok();
|
||||
@@ -291,7 +291,7 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str,
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if local_var_status.is_success() {
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<UpdateUserError> = serde_json::from_str(&local_var_content).ok();
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TSAxiosPestoreTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Axios Petstore Test Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -7,34 +7,7 @@
|
||||
"@openapitools/typescript-axios-petstore": {
|
||||
"version": "file:../../builds/with-npm-version",
|
||||
"requires": {
|
||||
"axios": "^0.19.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": {
|
||||
"version": "0.19.2",
|
||||
"bundled": true,
|
||||
"requires": {
|
||||
"follow-redirects": "1.5.10"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"bundled": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.5.10",
|
||||
"bundled": true,
|
||||
"requires": {
|
||||
"debug": "=3.1.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true
|
||||
}
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
@@ -311,7 +284,7 @@
|
||||
},
|
||||
"browserify-aes": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
|
||||
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -543,7 +516,7 @@
|
||||
},
|
||||
"convert-source-map": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "http://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz",
|
||||
"integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -573,7 +546,7 @@
|
||||
},
|
||||
"create-hash": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -586,7 +559,7 @@
|
||||
},
|
||||
"create-hmac": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -706,7 +679,7 @@
|
||||
},
|
||||
"diffie-hellman": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
|
||||
"integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -1892,7 +1865,7 @@
|
||||
},
|
||||
"sha.js": {
|
||||
"version": "2.4.11",
|
||||
"resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -2100,7 +2073,7 @@
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
|
||||
"dev": true
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": true,
|
||||
|
||||
@@ -37,7 +37,7 @@ export interface FindPetsByStatusRequest {
|
||||
}
|
||||
|
||||
export interface FindPetsByTagsRequest {
|
||||
tags: Array<string>;
|
||||
tags: Set<string>;
|
||||
}
|
||||
|
||||
export interface GetPetByIdRequest {
|
||||
@@ -203,7 +203,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* Finds Pets by tags
|
||||
*/
|
||||
async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest): Promise<runtime.ApiResponse<Array<Pet>>> {
|
||||
async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest): Promise<runtime.ApiResponse<Set<Pet>>> {
|
||||
if (requestParameters.tags === null || requestParameters.tags === undefined) {
|
||||
throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.');
|
||||
}
|
||||
@@ -239,7 +239,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* Finds Pets by tags
|
||||
*/
|
||||
async findPetsByTags(requestParameters: FindPetsByTagsRequest): Promise<Array<Pet>> {
|
||||
async findPetsByTags(requestParameters: FindPetsByTagsRequest): Promise<Set<Pet>> {
|
||||
const response = await this.findPetsByTagsRaw(requestParameters);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ export interface Pet {
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<string>}
|
||||
* @type {Set<string>}
|
||||
* @memberof Pet
|
||||
*/
|
||||
photoUrls: Array<string>;
|
||||
photoUrls: Set<string>;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Tag>}
|
||||
|
||||
@@ -39,19 +39,6 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -53,19 +53,6 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -67,7 +67,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -77,14 +77,13 @@ export class PetService {
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
'application/json',
|
||||
'application/xml'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
@@ -111,7 +110,7 @@ export class PetService {
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
if (apiKey !== undefined && apiKey !== null) {
|
||||
headers['api_key'] String(apiKey);
|
||||
headers['api_key'] = String(apiKey);
|
||||
}
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
@@ -133,7 +132,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -172,7 +170,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -183,7 +181,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@@ -223,7 +220,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -234,7 +231,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@@ -266,7 +262,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -277,7 +273,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -311,7 +306,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -321,14 +316,13 @@ export class PetService {
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
'application/json',
|
||||
'application/xml'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
@@ -392,6 +386,7 @@ export class PetService {
|
||||
if (name !== undefined) {
|
||||
formParams.append('name', <any>name);
|
||||
}
|
||||
|
||||
if (status !== undefined) {
|
||||
formParams.append('status', <any>status);
|
||||
}
|
||||
@@ -451,6 +446,7 @@ export class PetService {
|
||||
let formParams: { append(param: string, value: any): void; };
|
||||
let useForm = false;
|
||||
let convertFormParamsToString = false;
|
||||
|
||||
// use FormData to transmit files using content-type "multipart/form-data"
|
||||
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
|
||||
useForm = canConsumeForm;
|
||||
@@ -463,6 +459,7 @@ export class PetService {
|
||||
if (additionalMetadata !== undefined) {
|
||||
formParams.append('additionalMetadata', <any>additionalMetadata);
|
||||
}
|
||||
|
||||
if (file !== undefined) {
|
||||
formParams.append('file', <any>file);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -103,7 +102,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -129,7 +127,7 @@ export class StoreService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -140,7 +138,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -166,7 +163,7 @@ export class StoreService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -182,7 +179,6 @@ export class StoreService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
|
||||
@@ -77,7 +77,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
@@ -123,7 +122,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
@@ -169,7 +167,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
@@ -210,7 +207,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -236,7 +232,7 @@ export class UserService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -247,7 +243,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -286,7 +281,7 @@ export class UserService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@@ -297,7 +292,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@@ -333,7 +327,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@@ -383,7 +376,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
|
||||
@@ -121,7 +121,13 @@
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<<<<<<< HEAD
|
||||
<openapi-generator-version>5.1.0-SNAPSHOT</openapi-generator-version>
|
||||
=======
|
||||
<!-- RELEASE_VERSION -->
|
||||
<openapi-generator-version>5.0.1</openapi-generator-version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
>>>>>>> origin/master
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
</properties>
|
||||
|
||||
@@ -102,6 +102,7 @@ conf = x_auth_id_alias.Configuration(
|
||||
|
||||
def __init__(self, host=None,
|
||||
api_key=None, api_key_prefix=None,
|
||||
access_token=None,
|
||||
username=None, password=None,
|
||||
discard_unknown_keys=False,
|
||||
disabled_client_side_validations="",
|
||||
@@ -126,6 +127,7 @@ conf = x_auth_id_alias.Configuration(
|
||||
"""Temp file folder for downloading files
|
||||
"""
|
||||
# Authentication Settings
|
||||
self.access_token = access_token
|
||||
self.api_key = {}
|
||||
if api_key:
|
||||
self.api_key = api_key
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user