diff --git a/.travis.yml b/.travis.yml
index cf3357aa1fc..f8cb2a06187 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -45,6 +45,7 @@ cache:
- $HOME/.npm
- $HOME/.rvm/gems/ruby-2.4.1
- $HOME/website/node_modules/
+ - $HOME/.cache/deno
services:
- docker
@@ -119,6 +120,9 @@ before_install:
gpg --check-trustdb ;
fi;
- pushd .; cd website; yarn install; popd
+ # install Deno
+ - curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.1.2
+ - export PATH="$HOME/.deno/bin:$PATH"
install:
# Add Godeps dependencies to GOPATH and PATH
diff --git a/bin/typescript.sh b/bin/typescript.sh
index 3cde7ff0616..c9c07a7b01a 100755
--- a/bin/typescript.sh
+++ b/bin/typescript.sh
@@ -45,3 +45,7 @@ java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating fetch client with InversifyJS support!\033[0m\n"
args="-o $samples/inversify --additional-properties=platform=node,npmName=ts-petstore-client,useInversify=true $@"
java $JAVA_OPTS -jar $executable $common_args $args
+
+printf "\033[32m## Creating Deno (fetch) client!\033[0m\n"
+args="-o $samples/deno --additional-properties=platform=deno $@"
+java $JAVA_OPTS -jar $executable $common_args $args
diff --git a/bin/windows/typescript.bat b/bin/windows/typescript.bat
index a6e13ff4539..0e006951cf4 100755
--- a/bin/windows/typescript.bat
+++ b/bin/windows/typescript.bat
@@ -17,3 +17,6 @@ java %JAVA_OPTS% -jar %executable% %args%
set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\inversify --additional-properties=platform=node,npmName=ts-petstore-client,useInversify
java %JAVA_OPTS% -jar %executable% %args%
+
+set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\deno --additional-properties=platform=deno
+java %JAVA_OPTS% -jar %executable% %args%
diff --git a/docs/generators/typescript.md b/docs/generators/typescript.md
index c360c968b5f..00a4c3e22ae 100644
--- a/docs/generators/typescript.md
+++ b/docs/generators/typescript.md
@@ -8,20 +8,20 @@ sidebar_label: typescript
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|
- **false**
- The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
- **true**
- when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
-|fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser) / Buffer (node)| |Buffer|
+|fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)| |Buffer|
|framework|Specify the framework which should be used in the client code.|- **fetch-api**
- fetch-api
- **jquery**
- jquery
|fetch-api|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
-|platform|Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.|- **browser**
- browser
- **node**
- node
|browser|
+|platform|Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.|- **browser**
- browser
- **node**
- node
- **deno**
- deno
|browser|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|supportsES6|Generate code that conforms to ES6.| |false|
-|useInversify|Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container.| |false|
+|useInversify|Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container. If you set 'deno' as 'platform', the generator will process this value as 'disable'.| |false|
|useObjectParameters|Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.| |false|
|useRxJS|Enable this to internally use rxjs observables. If disabled, a stub is used instead. This is required for the 'angular' framework.| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java
index 2ae19df974f..512ddce35cb 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java
@@ -51,13 +51,13 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
private static final String[] FRAMEWORKS = { "fetch-api", "jquery" };
private static final String PLATFORM_SWITCH = "platform";
private static final String PLATFORM_SWITCH_DESC = "Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.";
- private static final String[] PLATFORMS = { "browser", "node" };
+ private static final String[] PLATFORMS = { "browser", "node", "deno" };
private static final String FILE_CONTENT_DATA_TYPE= "fileContentDataType";
- private static final String FILE_CONTENT_DATA_TYPE_DESC = "Specifies the type to use for the content of a file - i.e. Blob (Browser) / Buffer (node)";
+ private static final String FILE_CONTENT_DATA_TYPE_DESC = "Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)";
private static final String USE_RXJS_SWITCH = "useRxJS";
private static final String USE_RXJS_SWITCH_DESC = "Enable this to internally use rxjs observables. If disabled, a stub is used instead. This is required for the 'angular' framework.";
private static final String USE_INVERSIFY_SWITCH = "useInversify";
- private static final String USE_INVERSIFY_SWITCH_DESC = "Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container.";
+ private static final String USE_INVERSIFY_SWITCH_DESC = "Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container. If you set 'deno' as 'platform', the generator will process this value as 'disable'.";
private static final String USE_OBJECT_PARAMS_SWITCH = "useObjectParameters";
private static final String USE_OBJECT_PARAMS_DESC = "Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.";
@@ -187,10 +187,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(platformOption);
- //Documentation
- supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
- supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
- supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
+ // Git
supportingFiles.add(new SupportingFile(".gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
@@ -792,6 +789,16 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
additionalProperties.putIfAbsent(FILE_CONTENT_DATA_TYPE, propPlatform.equals("node") ? "Buffer" : "Blob");
+ if (!propPlatform.equals("deno")) {
+ supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
+ supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
+ supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
+ }
+
+ if (propPlatform.equals("deno")) {
+ additionalProperties.put("extensionForDeno", ".ts");
+ }
+
final boolean useRxJS = convertPropertyToBooleanAndWriteBack(USE_RXJS_SWITCH);
if (!useRxJS) {
supportingFiles.add(new SupportingFile("rxjsStub.mustache", "rxjsStub.ts"));
diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache
index e4bb60616ff..3bebe096502 100644
--- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache
@@ -1,21 +1,21 @@
// TODO: better import syntax?
-import { BaseAPIRequestFactory, RequiredError } from './baseapi';
-import {Configuration} from '../configuration';
-import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
+import { BaseAPIRequestFactory, RequiredError } from './baseapi{{extensionForDeno}}';
+import {Configuration} from '../configuration{{extensionForDeno}}';
+import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{extensionForDeno}}';
{{#platforms}}
{{#node}}
import * as FormData from "form-data";
{{/node}}
{{/platforms}}
-import {ObjectSerializer} from '../models/ObjectSerializer';
-import {ApiException} from './exception';
-import {isCodeInRange} from '../util';
+import {ObjectSerializer} from '../models/ObjectSerializer{{extensionForDeno}}';
+import {ApiException} from './exception{{extensionForDeno}}';
+import {isCodeInRange} from '../util{{extensionForDeno}}';
{{#useInversify}}
import { injectable } from "inversify";
{{/useInversify}}
{{#imports}}
-import { {{classname}} } from '..{{filename}}';
+import { {{classname}} } from '..{{filename}}{{extensionForDeno}}';
{{/imports}}
{{#operations}}
@@ -102,9 +102,9 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory {
{{#node}}
localVarFormParams.append('{{baseName}}', {{paramName}}.data, {{paramName}}.name);
{{/node}}
- {{#browser}}
+ {{^node}}
localVarFormParams.append('{{baseName}}', {{paramName}}, {{paramName}}.name);
- {{/browser}}
+ {{/node}}
{{/platforms}}
{{/isFile}}
}
diff --git a/modules/openapi-generator/src/main/resources/typescript/api/baseapi.mustache b/modules/openapi-generator/src/main/resources/typescript/api/baseapi.mustache
index 545fe4aacff..e33b699f1e7 100644
--- a/modules/openapi-generator/src/main/resources/typescript/api/baseapi.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/api/baseapi.mustache
@@ -1,4 +1,4 @@
-import { Configuration } from '../configuration'
+import { Configuration } from '../configuration{{extensionForDeno}}'
{{#useInversify}}
import { injectable, inject } from "inversify";
import { AbstractConfiguration } from "../services/configuration";
diff --git a/modules/openapi-generator/src/main/resources/typescript/api/middleware.mustache b/modules/openapi-generator/src/main/resources/typescript/api/middleware.mustache
index 1c5929a2d00..ee3a45bddcd 100644
--- a/modules/openapi-generator/src/main/resources/typescript/api/middleware.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/api/middleware.mustache
@@ -1,5 +1,5 @@
-import {RequestContext, ResponseContext} from './http/http';
-import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'./rxjsStub'{{/useRxJS}};
+import {RequestContext, ResponseContext} from './http/http{{extensionForDeno}}';
+import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'./rxjsStub{{extensionForDeno}}'{{/useRxJS}};
/**
* Defines the contract for a middleware intercepting requests before
diff --git a/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache b/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache
index 8e8d33d86d3..bab1d5b1bfa 100644
--- a/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache
@@ -5,7 +5,7 @@
import * as btoa from "btoa";
{{/node}}
{{/platforms}}
-import { RequestContext } from "../http/http";
+import { RequestContext } from "../http/http{{extensionForDeno}}";
{{#useInversify}}
import { injectable, inject, named } from "inversify";
import { AbstractTokenProvider } from "../services/configuration";
diff --git a/modules/openapi-generator/src/main/resources/typescript/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript/configuration.mustache
index 539e9b06138..38f46ded384 100644
--- a/modules/openapi-generator/src/main/resources/typescript/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/configuration.mustache
@@ -1,15 +1,15 @@
-import { HttpLibrary } from "./http/http";
-import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware";
+import { HttpLibrary } from "./http/http{{extensionForDeno}}";
+import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware{{extensionForDeno}}";
{{#frameworks}}
{{#fetch-api}}
-import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch";
+import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch{{extensionForDeno}}";
{{/fetch-api}}
{{#jquery}}
import { JQueryHttpLibrary as DefaultHttpLibrary } from "./http/jquery";
{{/jquery}}
{{/frameworks}}
-import { BaseServerConfiguration, server1 } from "./servers";
-import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth";
+import { BaseServerConfiguration, server1 } from "./servers{{extensionForDeno}}";
+import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth{{extensionForDeno}}";
export interface Configuration {
readonly baseServer: BaseServerConfiguration;
diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache
index dffa0dc544e..efb155c7df7 100644
--- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache
@@ -4,11 +4,17 @@
import * as FormData from "form-data";
{{/node}}
{{/platforms}}
+{{#platforms}}
+{{^deno}}
// typings of url-parse are incorrect...
// @ts-ignore
import * as URLParse from "url-parse";
-import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub'{{/useRxJS}};
+{{/deno}}
+{{/platforms}}
+import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}};
+{{#platforms}}
+{{^deno}}
{{#frameworks}}
{{#fetch-api}}
export * from './isomorphic-fetch';
@@ -17,6 +23,8 @@ export * from './isomorphic-fetch';
export * from './jquery';
{{/jquery}}
{{/frameworks}}
+{{/deno}}
+{{/platforms}}
/**
* Represents an HTTP method.
@@ -43,11 +51,44 @@ export type HttpFile = {
name: string
};
{{/node}}
-{{#browser}}
+{{^node}}
export type HttpFile = {{{fileContentDataType}}} & { readonly name: string };
-{{/browser}}
+{{/node}}
{{/platforms}}
+{{#platforms}}
+{{#deno}}
+/**
+ * URLParse Wrapper for Deno
+ */
+class URLParse {
+ private url: URL;
+ constructor(address: string, _parser: boolean) {
+ this.url = new URL(address);
+ }
+ public set(_part: 'query', obj: {[key: string]: string | undefined}) {
+ for (const key in obj) {
+ const value = obj[key];
+ if (value) {
+ this.url.searchParams.set(key, value);
+ } else {
+ this.url.searchParams.set(key, "");
+ }
+ }
+ }
+ public get query() {
+ const obj: {[key: string]: string} = {};
+ for (const [key, value] of this.url.searchParams.entries()) {
+ obj[key] = value;
+ }
+ return obj;
+ }
+ public toString() {
+ return this.url.toString();
+ }
+}
+{{/deno}}
+{{/platforms}}
export class HttpException extends Error {
public constructor(msg: string) {
@@ -75,7 +116,7 @@ export class RequestContext {
* @param httpMethod http method
*/
public constructor(url: string, private httpMethod: HttpMethod) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/*
@@ -91,7 +132,7 @@ export class RequestContext {
*
*/
public setUrl(url: string) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/**
@@ -177,6 +218,9 @@ export class SelfDecodingBody implements ResponseBody {
reader.readAsText(data);
});
{{/browser}}
+ {{#deno}}
+ return data.text();
+ {{/deno}}
{{/platforms}}
}
}
@@ -225,7 +269,7 @@ export class ResponseContext {
{{#node}}
return { data, name: fileName };
{{/node}}
- {{#browser}}
+ {{^node}}
const contentType = this.headers["content-type"] || "";
try {
return new File([data], fileName, { type: contentType });
@@ -236,7 +280,7 @@ export class ResponseContext {
type: contentType
});
}
- {{/browser}}
+ {{/node}}
{{/platforms}}
}
}
diff --git a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache
index 691b8187ccd..7646836694b 100644
--- a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache
@@ -1,5 +1,5 @@
-import {HttpLibrary, RequestContext, ResponseContext} from './http';
-import { from, Observable } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub'{{/useRxJS}};
+import {HttpLibrary, RequestContext, ResponseContext} from './http{{extensionForDeno}}';
+import { from, Observable } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}};
{{#platforms}}
{{#node}}
import fetch from "node-fetch";
diff --git a/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache b/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache
index aafda643217..7d7d66936ff 100644
--- a/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache
@@ -1,4 +1,4 @@
-import { RequestContext, HttpMethod } from "./http/http";
+import { RequestContext, HttpMethod } from "./http/http{{extensionForDeno}}";
export interface BaseServerConfiguration {
makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext;
diff --git a/modules/openapi-generator/src/main/resources/typescript/index.mustache b/modules/openapi-generator/src/main/resources/typescript/index.mustache
index 2302e5a1b45..3e4d0907d0e 100644
--- a/modules/openapi-generator/src/main/resources/typescript/index.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/index.mustache
@@ -1,41 +1,39 @@
-import "es6-promise/auto";
-
-export * from "./http/http";
-export * from "./auth/auth";
-export * from "./models/all";
-export { createConfiguration, Configuration } from "./configuration"
-export * from "./apis/exception";
-export * from "./servers";
+export * from "./http/http{{extensionForDeno}}";
+export * from "./auth/auth{{extensionForDeno}}";
+export * from "./models/all{{extensionForDeno}}";
+export { createConfiguration, Configuration } from "./configuration{{extensionForDeno}}"
+export * from "./apis/exception{{extensionForDeno}}";
+export * from "./servers{{extensionForDeno}}";
{{#useRxJS}}
-export { Middleware } from './middleware';
+export { Middleware } from './middleware{{extensionForDeno}}';
{{/useRxJS}}
{{^useRxJS}}
-export { PromiseMiddleware as Middleware } from './middleware';
+export { PromiseMiddleware as Middleware } from './middleware{{extensionForDeno}}';
{{/useRxJS}}
{{#useObjectParameters}}
-export { {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{classname}}{{operationIdCamelCase}}Request, {{/operation}}Object{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/ObjectParamAPI';
+export { {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{classname}}{{operationIdCamelCase}}Request, {{/operation}}Object{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/ObjectParamAPI{{extensionForDeno}}';
{{/useObjectParameters}}
{{^useObjectParameters}}
{{#useRxJS}}
-export { {{#apiInfo}}{{#apis}}{{#operations}}Observable{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/ObservableAPI';
+export { {{#apiInfo}}{{#apis}}{{#operations}}Observable{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/ObservableAPI{{extensionForDeno}}';
{{/useRxJS}}
{{^useRxJS}}
-export { {{#apiInfo}}{{#apis}}{{#operations}}Promise{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/PromiseAPI';
+export { {{#apiInfo}}{{#apis}}{{#operations}}Promise{{classname}} as {{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './types/PromiseAPI{{extensionForDeno}}';
{{/useRxJS}}
{{/useObjectParameters}}
{{#useInversify}}
-export * from "./services/index";
+export * from "./services/index{{extensionForDeno}}";
{{#useObjectParameters}}
export { {{#apiInfo}}{{#apis}}{{#operations}}AbstractObject{{classname}} as Abstract{{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './services/ObjectParamAPI';
{{/useObjectParameters}}
{{^useObjectParameters}}
{{#useRxJS}}
-export { {{#apiInfo}}{{#apis}}{{#operations}}AbstractObservable{{classname}} as Abstract{{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './services/ObservableAPI';
+export { {{#apiInfo}}{{#apis}}{{#operations}}AbstractObservable{{classname}} as Abstract{{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './services/ObservableAPI{{extensionForDeno}}';
{{/useRxJS}}
{{^useRxJS}}
-export { {{#apiInfo}}{{#apis}}{{#operations}}AbstractPromise{{classname}} as Abstract{{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './services/PromiseAPI';
+export { {{#apiInfo}}{{#apis}}{{#operations}}AbstractPromise{{classname}} as Abstract{{classname}}{{^-last}}, {{/-last}} {{/operations}}{{/apis}}{{/apiInfo}}} from './services/PromiseAPI{{extensionForDeno}}';
{{/useRxJS}}
{{/useObjectParameters}}
{{/useInversify}}
diff --git a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache
index 5a14d7ac344..8fa4417f4a6 100644
--- a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache
@@ -1,12 +1,12 @@
{{#models}}
{{#model}}
-export * from './{{{ classFilename }}}';
+export * from './{{{ classFilename }}}{{extensionForDeno}}';
{{/model}}
{{/models}}
{{#models}}
{{#model}}
-import { {{classname}}{{#hasEnums}}{{#vars}}{{#isEnum}}, {{classname}}{{enumName}} {{/isEnum}} {{/vars}}{{/hasEnums}} } from './{{{ classFilename }}}';
+import { {{classname}}{{#hasEnums}}{{#vars}}{{#isEnum}}, {{classname}}{{enumName}} {{/isEnum}} {{/vars}}{{/hasEnums}} } from './{{{ classFilename }}}{{extensionForDeno}}';
{{/model}}
{{/models}}
diff --git a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache
index eafef58daa0..b8df9a3a372 100644
--- a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache
@@ -2,9 +2,9 @@
{{#models}}
{{#model}}
{{#tsImports}}
-import { {{classname}} } from './{{filename}}';
+import { {{classname}} } from './{{filename}}{{extensionForDeno}}';
{{/tsImports}}
-import { HttpFile } from '../http/http';
+import { HttpFile } from '../http/http{{extensionForDeno}}';
{{#description}}
/**
diff --git a/modules/openapi-generator/src/main/resources/typescript/model/models_all.mustache b/modules/openapi-generator/src/main/resources/typescript/model/models_all.mustache
index 59c37a82422..43782db7ef5 100644
--- a/modules/openapi-generator/src/main/resources/typescript/model/models_all.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/model/models_all.mustache
@@ -1,5 +1,5 @@
{{#models}}
{{#model}}
-export * from './{{{ classFilename }}}'
+export * from './{{{ classFilename }}}{{extensionForDeno}}'
{{/model}}
{{/models}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache
index b9469283be3..9d8e23f8b2d 100644
--- a/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache
@@ -1,21 +1,21 @@
-import { ResponseContext, RequestContext, HttpFile } from '../http/http';
-import * as models from '../models/all';
-import { Configuration} from '../configuration'
+import { ResponseContext, RequestContext, HttpFile } from '../http/http{{extensionForDeno}}';
+import * as models from '../models/all{{extensionForDeno}}';
+import { Configuration} from '../configuration{{extensionForDeno}}'
{{#useRxJS}}
import { Observable } from 'rxjs';
{{/useRxJS}}
{{#models}}
{{#model}}
-import { {{{ classname }}} } from '../models/{{{ classFilename }}}';
+import { {{{ classname }}} } from '../models/{{{ classFilename }}}{{extensionForDeno}}';
{{/model}}
{{/models}}
{{#apiInfo}}
{{#apis}}
{{#operations}}
-import { Observable{{classname}} } from "./ObservableAPI";
-import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}";
+import { Observable{{classname}} } from "./ObservableAPI{{extensionForDeno}}";
+import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}{{extensionForDeno}}";
{{#operation}}
export interface {{classname}}{{operationIdCamelCase}}Request {
diff --git a/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache
index 79e1630a265..d0cadf56fbd 100644
--- a/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache
@@ -1,25 +1,25 @@
-import { ResponseContext, RequestContext, HttpFile } from '../http/http';
-import * as models from '../models/all';
-import { Configuration} from '../configuration'
-import { Observable, of, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub'{{/useRxJS}};
-import {mergeMap, map} from {{#useRxJS}}'rxjs/operators'{{/useRxJS}}{{^useRxJS}}'../rxjsStub'{{/useRxJS}};
+import { ResponseContext, RequestContext, HttpFile } from '../http/http{{extensionForDeno}}';
+import * as models from '../models/all{{extensionForDeno}}';
+import { Configuration} from '../configuration{{extensionForDeno}}'
+import { Observable, of, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}};
+import {mergeMap, map} from {{#useRxJS}}'rxjs/operators'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}};
{{#useInversify}}
import { injectable, inject, optional } from "inversify";
-import { AbstractConfiguration } from "../services/configuration";
+import { AbstractConfiguration } from "../services/configuration{{extensionForDeno}}";
{{/useInversify}}
{{#models}}
{{#model}}
-import { {{{ classname }}} } from '../models/{{{ classFilename }}}';
+import { {{{ classname }}} } from '../models/{{{ classFilename }}}{{extensionForDeno}}';
{{/model}}
{{/models}}
{{#apiInfo}}
{{#apis}}
{{#operations}}
-import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}";
+import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}{{extensionForDeno}}";
{{#useInversify}}
-import { Abstract{{classname}}RequestFactory, Abstract{{classname}}ResponseProcessor } from "../apis/{{classname}}.service";
+import { Abstract{{classname}}RequestFactory, Abstract{{classname}}ResponseProcessor } from "../apis/{{classname}}.service{{extensionForDeno}}";
@injectable()
{{/useInversify}}
diff --git a/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache
index 1bb0bdefe84..7e57347176b 100644
--- a/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache
@@ -1,6 +1,6 @@
-import { ResponseContext, RequestContext, HttpFile } from '../http/http';
-import * as models from '../models/all';
-import { Configuration} from '../configuration'
+import { ResponseContext, RequestContext, HttpFile } from '../http/http{{extensionForDeno}}';
+import * as models from '../models/all{{extensionForDeno}}';
+import { Configuration} from '../configuration{{extensionForDeno}}'
{{#useInversify}}
import { injectable, inject, optional } from "inversify";
import { AbstractConfiguration } from "../services/configuration";
@@ -8,16 +8,16 @@ import { AbstractConfiguration } from "../services/configuration";
{{#models}}
{{#model}}
-import { {{{ classname }}} } from '../models/{{{ classFilename }}}';
+import { {{{ classname }}} } from '../models/{{{ classFilename }}}{{extensionForDeno}}';
{{/model}}
{{/models}}
{{#apiInfo}}
{{#apis}}
-import { Observable{{classname}} } from './ObservableAPI';
+import { Observable{{classname}} } from './ObservableAPI{{extensionForDeno}}';
{{#operations}}
-import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}";
+import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "../apis/{{classname}}{{extensionForDeno}}";
{{#useInversify}}
import { Abstract{{classname}}RequestFactory, Abstract{{classname}}ResponseProcessor } from "../apis/{{classname}}.service";
diff --git a/pom.xml b/pom.xml
index 966ef9caab4..86b7c3b1eec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -927,6 +927,18 @@
samples/openapi3/client/petstore/typescript/tests/default
+
+ typescript-client-tests-deno
+
+
+ env
+ java
+
+
+
+ samples/openapi3/client/petstore/typescript/tests/deno
+
+
typescript-client-tests-jquery
@@ -1199,6 +1211,7 @@
samples/openapi3/client/petstore/typescript/tests/object_params
samples/openapi3/client/petstore/typescript/builds/inversify
samples/openapi3/client/petstore/typescript/tests/inversify
+ samples/openapi3/client/petstore/typescript/tests/deno
samples/client/petstore/typescript-fetch/builds/default
samples/client/petstore/typescript-fetch/builds/es6-target
samples/client/petstore/typescript-fetch/builds/with-npm-version
diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts
index ac32e72aa98..4241ca3d329 100644
--- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts
@@ -57,7 +57,7 @@ export class RequestContext {
* @param httpMethod http method
*/
public constructor(url: string, private httpMethod: HttpMethod) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/*
@@ -73,7 +73,7 @@ export class RequestContext {
*
*/
public setUrl(url: string) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/**
diff --git a/samples/openapi3/client/petstore/typescript/builds/default/index.ts b/samples/openapi3/client/petstore/typescript/builds/default/index.ts
index cbc24ba3554..fe00e36cbd8 100644
--- a/samples/openapi3/client/petstore/typescript/builds/default/index.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/default/index.ts
@@ -1,5 +1,3 @@
-import "es6-promise/auto";
-
export * from "./http/http";
export * from "./auth/auth";
export * from "./models/all";
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/.gitignore b/samples/openapi3/client/petstore/typescript/builds/deno/.gitignore
new file mode 100644
index 00000000000..1521c8b7652
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/.gitignore
@@ -0,0 +1 @@
+dist
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator-ignore b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/FILES b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/FILES
new file mode 100644
index 00000000000..b31c76a281f
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/FILES
@@ -0,0 +1,29 @@
+.gitignore
+apis/PetApi.ts
+apis/StoreApi.ts
+apis/UserApi.ts
+apis/baseapi.ts
+apis/exception.ts
+auth/auth.ts
+configuration.ts
+git_push.sh
+http/http.ts
+http/isomorphic-fetch.ts
+index.ts
+middleware.ts
+models/ApiResponse.ts
+models/Category.ts
+models/InlineObject.ts
+models/InlineObject1.ts
+models/ObjectSerializer.ts
+models/Order.ts
+models/Pet.ts
+models/Tag.ts
+models/User.ts
+models/all.ts
+rxjsStub.ts
+servers.ts
+types/ObjectParamAPI.ts
+types/ObservableAPI.ts
+types/PromiseAPI.ts
+util.ts
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/VERSION b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/VERSION
new file mode 100644
index 00000000000..d99e7162d01
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/.openapi-generator/VERSION
@@ -0,0 +1 @@
+5.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts
new file mode 100644
index 00000000000..c12dd49f6c0
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts
@@ -0,0 +1,649 @@
+// TODO: better import syntax?
+import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
+import {Configuration} from '../configuration.ts';
+import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
+import {ObjectSerializer} from '../models/ObjectSerializer.ts';
+import {ApiException} from './exception.ts';
+import {isCodeInRange} from '../util.ts';
+
+import { ApiResponse } from '../models/ApiResponse.ts';
+import { Pet } from '../models/Pet.ts';
+
+/**
+ * no description
+ */
+export class PetApiRequestFactory extends BaseAPIRequestFactory {
+
+ /**
+ * Add a new pet to the store
+ * @param pet Pet object that needs to be added to the store
+ */
+ public async addPet(pet: Pet, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'pet' is not null or undefined
+ if (pet === null || pet === undefined) {
+ throw new RequiredError('Required parameter pet was null or undefined when calling addPet.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/pet';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json",
+
+ "application/xml"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(pet, "Pet", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Deletes a pet
+ * @param petId Pet id to delete
+ * @param apiKey
+ */
+ public async deletePet(petId: number, apiKey?: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new RequiredError('Required parameter petId was null or undefined when calling deletePet.');
+ }
+
+
+
+ // Path Params
+ const localVarPath = '/pet/{petId}'
+ .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+ requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Multiple status values can be provided with comma separated strings
+ * Finds Pets by status
+ * @param status Status values that need to be considered for filter
+ */
+ public async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'status' is not null or undefined
+ if (status === null || status === undefined) {
+ throw new RequiredError('Required parameter status was null or undefined when calling findPetsByStatus.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/pet/findByStatus';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+ if (status !== undefined) {
+ requestContext.setQueryParam("status", ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>", ""));
+ }
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * Finds Pets by tags
+ * @param tags Tags to filter by
+ */
+ public async findPetsByTags(tags: Array, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'tags' is not null or undefined
+ if (tags === null || tags === undefined) {
+ throw new RequiredError('Required parameter tags was null or undefined when calling findPetsByTags.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/pet/findByTags';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+ if (tags !== undefined) {
+ requestContext.setQueryParam("tags", ObjectSerializer.serialize(tags, "Array", ""));
+ }
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Returns a single pet
+ * Find pet by ID
+ * @param petId ID of pet to return
+ */
+ public async getPetById(petId: number, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new RequiredError('Required parameter petId was null or undefined when calling getPetById.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/pet/{petId}'
+ .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Update an existing pet
+ * @param pet Pet object that needs to be added to the store
+ */
+ public async updatePet(pet: Pet, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'pet' is not null or undefined
+ if (pet === null || pet === undefined) {
+ throw new RequiredError('Required parameter pet was null or undefined when calling updatePet.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/pet';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json",
+
+ "application/xml"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(pet, "Pet", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ */
+ public async updatePetWithForm(petId: number, name?: string, status?: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new RequiredError('Required parameter petId was null or undefined when calling updatePetWithForm.');
+ }
+
+
+
+
+ // Path Params
+ const localVarPath = '/pet/{petId}'
+ .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+ let localVarFormParams = new FormData();
+
+ if (name !== undefined) {
+ // TODO: replace .append with .set
+ localVarFormParams.append('name', name as any);
+ }
+ if (status !== undefined) {
+ // TODO: replace .append with .set
+ localVarFormParams.append('status', status as any);
+ }
+ requestContext.setBody(localVarFormParams);
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * uploads an image
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server
+ * @param file file to upload
+ */
+ public async uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new RequiredError('Required parameter petId was null or undefined when calling uploadFile.');
+ }
+
+
+
+
+ // Path Params
+ const localVarPath = '/pet/{petId}/uploadImage'
+ .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+ let localVarFormParams = new FormData();
+
+ if (additionalMetadata !== undefined) {
+ // TODO: replace .append with .set
+ localVarFormParams.append('additionalMetadata', additionalMetadata as any);
+ }
+ if (file !== undefined) {
+ // TODO: replace .append with .set
+ localVarFormParams.append('file', file, file.name);
+ }
+ requestContext.setBody(localVarFormParams);
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["petstore_auth"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+}
+
+
+
+export class PetApiResponseProcessor {
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to addPet
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async addPet(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+ if (isCodeInRange("405", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid input");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to deletePet
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async deletePet(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid pet value");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to findPetsByStatus
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async findPetsByStatus(response: ResponseContext): Promise > {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Array = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Array", ""
+ ) as Array;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid status value");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Array = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Array", ""
+ ) as Array;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to findPetsByTags
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async findPetsByTags(response: ResponseContext): Promise > {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Array = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Array", ""
+ ) as Array;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid tag value");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Array = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Array", ""
+ ) as Array;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to getPetById
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async getPetById(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid ID supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Pet not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to updatePet
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async updatePet(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid ID supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Pet not found");
+ }
+ if (isCodeInRange("405", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Validation exception");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Pet = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Pet", ""
+ ) as Pet;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to updatePetWithForm
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async updatePetWithForm(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("405", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid input");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to uploadFile
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async uploadFile(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: ApiResponse = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "ApiResponse", ""
+ ) as ApiResponse;
+ return body;
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: ApiResponse = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "ApiResponse", ""
+ ) as ApiResponse;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts
new file mode 100644
index 00000000000..7580325378f
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts
@@ -0,0 +1,294 @@
+// TODO: better import syntax?
+import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
+import {Configuration} from '../configuration.ts';
+import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
+import {ObjectSerializer} from '../models/ObjectSerializer.ts';
+import {ApiException} from './exception.ts';
+import {isCodeInRange} from '../util.ts';
+
+import { Order } from '../models/Order.ts';
+
+/**
+ * no description
+ */
+export class StoreApiRequestFactory extends BaseAPIRequestFactory {
+
+ /**
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * Delete purchase order by ID
+ * @param orderId ID of the order that needs to be deleted
+ */
+ public async deleteOrder(orderId: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'orderId' is not null or undefined
+ if (orderId === null || orderId === undefined) {
+ throw new RequiredError('Required parameter orderId was null or undefined when calling deleteOrder.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/store/order/{orderId}'
+ .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ // Apply auth methods
+
+ return requestContext;
+ }
+
+ /**
+ * Returns a map of status codes to quantities
+ * Returns pet inventories by status
+ */
+ public async getInventory(options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // Path Params
+ const localVarPath = '/store/inventory';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * Find purchase order by ID
+ * @param orderId ID of pet that needs to be fetched
+ */
+ public async getOrderById(orderId: number, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'orderId' is not null or undefined
+ if (orderId === null || orderId === undefined) {
+ throw new RequiredError('Required parameter orderId was null or undefined when calling getOrderById.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/store/order/{orderId}'
+ .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ // Apply auth methods
+
+ return requestContext;
+ }
+
+ /**
+ * Place an order for a pet
+ * @param order order placed for purchasing the pet
+ */
+ public async placeOrder(order: Order, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'order' is not null or undefined
+ if (order === null || order === undefined) {
+ throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/store/order';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(order, "Order", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ // Apply auth methods
+
+ return requestContext;
+ }
+
+}
+
+
+
+export class StoreApiResponseProcessor {
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to deleteOrder
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async deleteOrder(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid ID supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Order not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to getInventory
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: { [key: string]: number; } = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "{ [key: string]: number; }", "int32"
+ ) as { [key: string]: number; };
+ return body;
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: { [key: string]: number; } = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "{ [key: string]: number; }", "int32"
+ ) as { [key: string]: number; };
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to getOrderById
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async getOrderById(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Order = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Order", ""
+ ) as Order;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid ID supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Order not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Order = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Order", ""
+ ) as Order;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to placeOrder
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async placeOrder(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: Order = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Order", ""
+ ) as Order;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid Order");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: Order = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "Order", ""
+ ) as Order;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts
new file mode 100644
index 00000000000..5744990ab8a
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts
@@ -0,0 +1,586 @@
+// TODO: better import syntax?
+import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
+import {Configuration} from '../configuration.ts';
+import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
+import {ObjectSerializer} from '../models/ObjectSerializer.ts';
+import {ApiException} from './exception.ts';
+import {isCodeInRange} from '../util.ts';
+
+import { User } from '../models/User.ts';
+
+/**
+ * no description
+ */
+export class UserApiRequestFactory extends BaseAPIRequestFactory {
+
+ /**
+ * This can only be done by the logged in user.
+ * Create user
+ * @param user Created user object
+ */
+ public async createUser(user: User, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'user' is not null or undefined
+ if (user === null || user === undefined) {
+ throw new RequiredError('Required parameter user was null or undefined when calling createUser.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(user, "User", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public async createUsersWithArrayInput(user: Array, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'user' is not null or undefined
+ if (user === null || user === undefined) {
+ throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/createWithArray';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(user, "Array", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public async createUsersWithListInput(user: Array, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'user' is not null or undefined
+ if (user === null || user === undefined) {
+ throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/createWithList';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(user, "Array", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Delete user
+ * @param username The name that needs to be deleted
+ */
+ public async deleteUser(username: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new RequiredError('Required parameter username was null or undefined when calling deleteUser.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/{username}'
+ .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * Get user by user name
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ public async getUserByName(username: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new RequiredError('Required parameter username was null or undefined when calling getUserByName.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/{username}'
+ .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ // Apply auth methods
+
+ return requestContext;
+ }
+
+ /**
+ * Logs user into the system
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ public async loginUser(username: string, password: string, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new RequiredError('Required parameter username was null or undefined when calling loginUser.');
+ }
+
+
+ // verify required parameter 'password' is not null or undefined
+ if (password === null || password === undefined) {
+ throw new RequiredError('Required parameter password was null or undefined when calling loginUser.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/login';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+ if (username !== undefined) {
+ requestContext.setQueryParam("username", ObjectSerializer.serialize(username, "string", ""));
+ }
+ if (password !== undefined) {
+ requestContext.setQueryParam("password", ObjectSerializer.serialize(password, "string", ""));
+ }
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ // Apply auth methods
+
+ return requestContext;
+ }
+
+ /**
+ * Logs out current logged in user session
+ */
+ public async logoutUser(options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // Path Params
+ const localVarPath = '/user/logout';
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Updated user
+ * @param username name that need to be deleted
+ * @param user Updated user object
+ */
+ public async updateUser(username: string, user: User, options?: Configuration): Promise {
+ let config = options || this.configuration;
+
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new RequiredError('Required parameter username was null or undefined when calling updateUser.');
+ }
+
+
+ // verify required parameter 'user' is not null or undefined
+ if (user === null || user === undefined) {
+ throw new RequiredError('Required parameter user was null or undefined when calling updateUser.');
+ }
+
+
+ // Path Params
+ const localVarPath = '/user/{username}'
+ .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
+
+ // Make Request Context
+ const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT);
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
+
+ // Query Params
+
+ // Header Params
+
+ // Form Params
+
+
+ // Body Params
+ const contentType = ObjectSerializer.getPreferredMediaType([
+ "application/json"
+ ]);
+ requestContext.setHeaderParam("Content-Type", contentType);
+ const serializedBody = ObjectSerializer.stringify(
+ ObjectSerializer.serialize(user, "User", ""),
+ contentType
+ );
+ requestContext.setBody(serializedBody);
+
+ let authMethod = null;
+ // Apply auth methods
+ authMethod = config.authMethods["api_key"]
+ if (authMethod) {
+ await authMethod.applySecurityAuthentication(requestContext);
+ }
+
+ return requestContext;
+ }
+
+}
+
+
+
+export class UserApiResponseProcessor {
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to createUser
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async createUser(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("0", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "successful operation");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to createUsersWithArrayInput
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async createUsersWithArrayInput(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("0", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "successful operation");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to createUsersWithListInput
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async createUsersWithListInput(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("0", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "successful operation");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to deleteUser
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async deleteUser(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid username supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "User not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to getUserByName
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async getUserByName(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: User = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "User", ""
+ ) as User;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid username supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "User not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: User = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "User", ""
+ ) as User;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to loginUser
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async loginUser(response: ResponseContext): Promise {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("200", response.httpStatusCode)) {
+ const body: string = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "string", ""
+ ) as string;
+ return body;
+ }
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid username/password supplied");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ const body: string = ObjectSerializer.deserialize(
+ ObjectSerializer.parse(await response.body.text(), contentType),
+ "string", ""
+ ) as string;
+ return body;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to logoutUser
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async logoutUser(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("0", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "successful operation");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+ /**
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
+ * to the expected objects
+ *
+ * @params response Response returned by the server for a request to updateUser
+ * @throws ApiException if the response code was not in [200, 299]
+ */
+ public async updateUser(response: ResponseContext): Promise< void> {
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
+ if (isCodeInRange("400", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "Invalid user supplied");
+ }
+ if (isCodeInRange("404", response.httpStatusCode)) {
+ throw new ApiException(response.httpStatusCode, "User not found");
+ }
+
+ // Work around for missing responses in specification, e.g. for petstore.yaml
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
+ return;
+ }
+
+ let body = response.body || "";
+ throw new ApiException(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\"");
+ }
+
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/baseapi.ts
new file mode 100644
index 00000000000..a9f232827df
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/baseapi.ts
@@ -0,0 +1,37 @@
+import { Configuration } from '../configuration.ts'
+
+/**
+ *
+ * @export
+ */
+export const COLLECTION_FORMATS = {
+ csv: ",",
+ ssv: " ",
+ tsv: "\t",
+ pipes: "|",
+};
+
+
+/**
+ *
+ * @export
+ * @class BaseAPI
+ */
+export class BaseAPIRequestFactory {
+
+ constructor(protected configuration: Configuration) {
+ }
+};
+
+/**
+ *
+ * @export
+ * @class RequiredError
+ * @extends {Error}
+ */
+export class RequiredError extends Error {
+ name: "RequiredError" = "RequiredError";
+ constructor(public field: string, msg?: string) {
+ super(msg);
+ }
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/exception.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/exception.ts
new file mode 100644
index 00000000000..b76dca5aa4b
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/exception.ts
@@ -0,0 +1,14 @@
+/**
+ * Represents an error caused by an api call i.e. it has attributes for a HTTP status code
+ * and the returned body object.
+ *
+ * Example
+ * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
+ * => ApiException(404, someErrorMessageObject)
+ *
+ */
+export class ApiException extends Error {
+ public constructor(public code: number, public body: T) {
+ super("HTTP-Code: " + code + "\nMessage: " + JSON.stringify(body))
+ }
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts
new file mode 100644
index 00000000000..0a02d2e58d2
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts
@@ -0,0 +1,100 @@
+// typings for btoa are incorrect
+import { RequestContext } from "../http/http.ts";
+
+/**
+ * Interface authentication schemes.
+ */
+export interface SecurityAuthentication {
+ /*
+ * @return returns the name of the security authentication as specified in OAI
+ */
+ getName(): string;
+
+ /**
+ * Applies the authentication scheme to the request context
+ *
+ * @params context the request context which should use this authentication scheme
+ */
+ applySecurityAuthentication(context: RequestContext): void | Promise;
+}
+
+export interface TokenProvider {
+ getToken(): Promise | string;
+}
+
+/**
+ * Applies apiKey authentication to the request context.
+ */
+export class ApiKeyAuthentication implements SecurityAuthentication {
+ /**
+ * Configures this api key authentication with the necessary properties
+ *
+ * @param apiKey: The api key to be used for every request
+ */
+ public constructor(private apiKey: string) {}
+
+ public getName(): string {
+ return "api_key";
+ }
+
+ public applySecurityAuthentication(context: RequestContext) {
+ context.setHeaderParam("api_key", this.apiKey);
+ }
+}
+
+/**
+ * Applies oauth2 authentication to the request context.
+ */
+export class PetstoreAuthAuthentication implements SecurityAuthentication {
+ // TODO: How to handle oauth2 authentication!
+ public constructor() {}
+
+ public getName(): string {
+ return "petstore_auth";
+ }
+
+ public applySecurityAuthentication(context: RequestContext) {
+ // TODO
+ }
+}
+
+
+export type AuthMethods = {
+ "api_key"?: SecurityAuthentication,
+ "petstore_auth"?: SecurityAuthentication
+}
+
+export type ApiKeyConfiguration = string;
+export type HttpBasicConfiguration = { "username": string, "password": string };
+export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
+export type OAuth2Configuration = string;
+
+export type AuthMethodsConfiguration = {
+ "api_key"?: ApiKeyConfiguration,
+ "petstore_auth"?: OAuth2Configuration
+}
+
+/**
+ * Creates the authentication methods from a swagger description.
+ *
+ */
+export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods {
+ let authMethods: AuthMethods = {}
+
+ if (!config) {
+ return authMethods;
+ }
+
+ if (config["api_key"]) {
+ authMethods["api_key"] = new ApiKeyAuthentication(
+ config["api_key"]
+ );
+ }
+
+ if (config["petstore_auth"]) {
+ authMethods["petstore_auth"] = new PetstoreAuthAuthentication(
+ );
+ }
+
+ return authMethods;
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/configuration.ts b/samples/openapi3/client/petstore/typescript/builds/deno/configuration.ts
new file mode 100644
index 00000000000..27350b5e467
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/configuration.ts
@@ -0,0 +1,66 @@
+import { HttpLibrary } from "./http/http.ts";
+import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware.ts";
+import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch.ts";
+import { BaseServerConfiguration, server1 } from "./servers.ts";
+import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth.ts";
+
+export interface Configuration {
+ readonly baseServer: BaseServerConfiguration;
+ readonly httpApi: HttpLibrary;
+ readonly middleware: Middleware[];
+ readonly authMethods: AuthMethods;
+}
+
+
+/**
+ * Interface with which a configuration object can be configured.
+ */
+export interface ConfigurationParameters {
+ /**
+ * Default server to use
+ */
+ baseServer?: BaseServerConfiguration;
+ /**
+ * HTTP library to use e.g. IsomorphicFetch
+ */
+ httpApi?: HttpLibrary;
+ /**
+ * The middlewares which will be applied to requests and responses
+ */
+ middleware?: Middleware[];
+ /**
+ * Configures all middlewares using the promise api instead of observables (which Middleware uses)
+ */
+ promiseMiddleware?: PromiseMiddleware[];
+ /**
+ * Configuration for the available authentication methods
+ */
+ authMethods?: AuthMethodsConfiguration
+}
+
+/**
+ * Configuration factory function
+ *
+ * If a property is not included in conf, a default is used:
+ * - baseServer: server1
+ * - httpApi: IsomorphicFetchHttpLibrary
+ * - middleware: []
+ * - promiseMiddleware: []
+ * - authMethods: {}
+ *
+ * @param conf partial configuration
+ */
+export function createConfiguration(conf: ConfigurationParameters = {}): Configuration {
+ const configuration: Configuration = {
+ baseServer: conf.baseServer !== undefined ? conf.baseServer : server1,
+ httpApi: conf.httpApi || new DefaultHttpLibrary(),
+ middleware: conf.middleware || [],
+ authMethods: configureAuthMethods(conf.authMethods)
+ };
+ if (conf.promiseMiddleware) {
+ conf.promiseMiddleware.forEach(
+ m => configuration.middleware.push(new PromiseMiddlewareWrapper(m))
+ );
+ }
+ return configuration;
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/git_push.sh b/samples/openapi3/client/petstore/typescript/builds/deno/git_push.sh
new file mode 100644
index 00000000000..8442b80bb44
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/git_push.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts
new file mode 100644
index 00000000000..7bb54a77ff9
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts
@@ -0,0 +1,235 @@
+import { Observable, from } from '../rxjsStub.ts';
+
+
+/**
+ * Represents an HTTP method.
+ */
+export enum HttpMethod {
+ GET = "GET",
+ HEAD = "HEAD",
+ POST = "POST",
+ PUT = "PUT",
+ DELETE = "DELETE",
+ CONNECT = "CONNECT",
+ OPTIONS = "OPTIONS",
+ TRACE = "TRACE",
+ PATCH = "PATCH"
+}
+
+/**
+ * Represents an HTTP file which will be transferred from or to a server.
+ */
+export type HttpFile = Blob & { readonly name: string };
+
+/**
+ * URLParse Wrapper for Deno
+ */
+class URLParse {
+ private url: URL;
+ constructor(address: string, _parser: boolean) {
+ this.url = new URL(address);
+ }
+ public set(_part: 'query', obj: {[key: string]: string | undefined}) {
+ for (const key in obj) {
+ const value = obj[key];
+ if (value) {
+ this.url.searchParams.set(key, value);
+ } else {
+ this.url.searchParams.set(key, "");
+ }
+ }
+ }
+ public get query() {
+ const obj: {[key: string]: string} = {};
+ for (const [key, value] of this.url.searchParams.entries()) {
+ obj[key] = value;
+ }
+ return obj;
+ }
+ public toString() {
+ return this.url.toString();
+ }
+}
+
+export class HttpException extends Error {
+ public constructor(msg: string) {
+ super(msg);
+ }
+}
+
+/**
+ * Represents the body of an outgoing HTTP request.
+ */
+export type RequestBody = undefined | string | FormData;
+
+/**
+ * Represents an HTTP request context
+ */
+export class RequestContext {
+ private headers: { [key: string]: string } = {};
+ private body: RequestBody = undefined;
+ private url: URLParse;
+
+ /**
+ * Creates the request context using a http method and request resource url
+ *
+ * @param url url of the requested resource
+ * @param httpMethod http method
+ */
+ public constructor(url: string, private httpMethod: HttpMethod) {
+ this.url = new URLParse(url, true);
+ }
+
+ /*
+ * Returns the url set in the constructor including the query string
+ *
+ */
+ public getUrl(): string {
+ return this.url.toString();
+ }
+
+ /**
+ * Replaces the url set in the constructor with this url.
+ *
+ */
+ public setUrl(url: string) {
+ this.url = new URLParse(url, true);
+ }
+
+ /**
+ * Sets the body of the http request either as a string or FormData
+ *
+ * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE
+ * request is discouraged.
+ * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1
+ *
+ * @param body the body of the request
+ */
+ public setBody(body: RequestBody) {
+ this.body = body;
+ }
+
+ public getHttpMethod(): HttpMethod {
+ return this.httpMethod;
+ }
+
+ public getHeaders(): { [key: string]: string } {
+ return this.headers;
+ }
+
+ public getBody(): RequestBody {
+ return this.body;
+ }
+
+ public setQueryParam(name: string, value: string) {
+ let queryObj = this.url.query;
+ queryObj[name] = value;
+ this.url.set("query", queryObj);
+ }
+
+ /**
+ * Sets a cookie with the name and value. NO check for duplicate cookies is performed
+ *
+ */
+ public addCookie(name: string, value: string): void {
+ if (!this.headers["Cookie"]) {
+ this.headers["Cookie"] = "";
+ }
+ this.headers["Cookie"] += name + "=" + value + "; ";
+ }
+
+ public setHeaderParam(key: string, value: string): void {
+ this.headers[key] = value;
+ }
+}
+
+export interface ResponseBody {
+ text(): Promise;
+ binary(): Promise;
+}
+
+
+/**
+ * Helper class to generate a `ResponseBody` from binary data
+ */
+export class SelfDecodingBody implements ResponseBody {
+ constructor(private dataSource: Promise) {}
+
+ binary(): Promise {
+ return this.dataSource;
+ }
+
+ async text(): Promise {
+ const data: Blob = await this.dataSource;
+ return data.text();
+ }
+}
+
+export class ResponseContext {
+ public constructor(
+ public httpStatusCode: number,
+ public headers: { [key: string]: string },
+ public body: ResponseBody
+ ) {}
+
+ /**
+ * Parse header value in the form `value; param1="value1"`
+ *
+ * E.g. for Content-Type or Content-Disposition
+ * Parameter names are converted to lower case
+ * The first parameter is returned with the key `""`
+ */
+ public getParsedHeader(headerName: string): { [parameter: string]: string } {
+ const result: { [parameter: string]: string } = {};
+ if (!this.headers[headerName]) {
+ return result;
+ }
+
+ const parameters = this.headers[headerName].split(";");
+ for (const parameter of parameters) {
+ let [key, value] = parameter.split("=", 2);
+ key = key.toLowerCase().trim();
+ if (value === undefined) {
+ result[""] = key;
+ } else {
+ value = value.trim();
+ if (value.startsWith('"') && value.endsWith('"')) {
+ value = value.substring(1, value.length - 1);
+ }
+ result[key] = value;
+ }
+ }
+ return result;
+ }
+
+ public async getBodyAsFile(): Promise {
+ const data = await this.body.binary();
+ const fileName = this.getParsedHeader("content-disposition")["filename"] || "";
+ const contentType = this.headers["content-type"] || "";
+ try {
+ return new File([data], fileName, { type: contentType });
+ } catch (error) {
+ /** Fallback for when the File constructor is not available */
+ return Object.assign(data, {
+ name: fileName,
+ type: contentType
+ });
+ }
+ }
+}
+
+export interface HttpLibrary {
+ send(request: RequestContext): Observable;
+}
+
+export interface PromiseHttpLibrary {
+ send(request: RequestContext): Promise;
+}
+
+export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary {
+ return {
+ send(request: RequestContext): Observable {
+ return from(promiseHttpLibrary.send(request));
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/isomorphic-fetch.ts
new file mode 100644
index 00000000000..a7521351e06
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/isomorphic-fetch.ts
@@ -0,0 +1,30 @@
+import {HttpLibrary, RequestContext, ResponseContext} from './http.ts';
+import { from, Observable } from '../rxjsStub.ts';
+
+export class IsomorphicFetchHttpLibrary implements HttpLibrary {
+
+ public send(request: RequestContext): Observable {
+ let method = request.getHttpMethod().toString();
+ let body = request.getBody();
+
+ const resultPromise = fetch(request.getUrl(), {
+ method: method,
+ body: body as any,
+ headers: request.getHeaders(),
+ }).then((resp: any) => {
+ const headers: { [name: string]: string } = {};
+ resp.headers.forEach((value: string, name: string) => {
+ headers[name] = value;
+ });
+
+ const body = {
+ text: () => resp.text(),
+ binary: () => resp.blob()
+ };
+ return new ResponseContext(resp.status, headers, body);
+ });
+
+ return from>(resultPromise);
+
+ }
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/index.ts b/samples/openapi3/client/petstore/typescript/builds/deno/index.ts
new file mode 100644
index 00000000000..b0cc9f0f93d
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/index.ts
@@ -0,0 +1,10 @@
+export * from "./http/http.ts";
+export * from "./auth/auth.ts";
+export * from "./models/all.ts";
+export { createConfiguration, Configuration } from "./configuration.ts"
+export * from "./apis/exception.ts";
+export * from "./servers.ts";
+
+export { PromiseMiddleware as Middleware } from './middleware.ts';
+export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI.ts';
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/middleware.ts b/samples/openapi3/client/petstore/typescript/builds/deno/middleware.ts
new file mode 100644
index 00000000000..8b55bf362b4
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/middleware.ts
@@ -0,0 +1,66 @@
+import {RequestContext, ResponseContext} from './http/http.ts';
+import { Observable, from } from './rxjsStub.ts';
+
+/**
+ * Defines the contract for a middleware intercepting requests before
+ * they are sent (but after the RequestContext was created)
+ * and before the ResponseContext is unwrapped.
+ *
+ */
+export interface Middleware {
+ /**
+ * Modifies the request before the request is sent.
+ *
+ * @param context RequestContext of a request which is about to be sent to the server
+ * @returns an observable of the updated request context
+ *
+ */
+ pre(context: RequestContext): Observable;
+ /**
+ * Modifies the returned response before it is deserialized.
+ *
+ * @param context ResponseContext of a sent request
+ * @returns an observable of the modified response context
+ */
+ post(context: ResponseContext): Observable;
+}
+
+export class PromiseMiddlewareWrapper implements Middleware {
+
+ public constructor(private middleware: PromiseMiddleware) {
+
+ }
+
+ pre(context: RequestContext): Observable {
+ return from(this.middleware.pre(context));
+ }
+
+ post(context: ResponseContext): Observable {
+ return from(this.middleware.post(context));
+ }
+
+}
+
+/**
+ * Defines the contract for a middleware intercepting requests before
+ * they are sent (but after the RequestContext was created)
+ * and before the ResponseContext is unwrapped.
+ *
+ */
+export interface PromiseMiddleware {
+ /**
+ * Modifies the request before the request is sent.
+ *
+ * @param context RequestContext of a request which is about to be sent to the server
+ * @returns an observable of the updated request context
+ *
+ */
+ pre(context: RequestContext): Promise;
+ /**
+ * Modifies the returned response before it is deserialized.
+ *
+ * @param context ResponseContext of a sent request
+ * @returns an observable of the modified response context
+ */
+ post(context: ResponseContext): Promise;
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts
new file mode 100644
index 00000000000..7c0afc4eb54
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts
@@ -0,0 +1,52 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+/**
+* Describes the result of uploading an image resource
+*/
+export class ApiResponse {
+ 'code'?: number;
+ 'type'?: string;
+ 'message'?: string;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "code",
+ "baseName": "code",
+ "type": "number",
+ "format": "int32"
+ },
+ {
+ "name": "type",
+ "baseName": "type",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "message",
+ "baseName": "message",
+ "type": "string",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return ApiResponse.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts
new file mode 100644
index 00000000000..8257545297b
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts
@@ -0,0 +1,45 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+/**
+* A category for a pet
+*/
+export class Category {
+ 'id'?: number;
+ 'name'?: string;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "id",
+ "baseName": "id",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "name",
+ "baseName": "name",
+ "type": "string",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return Category.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject.ts
new file mode 100644
index 00000000000..f4415932067
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject.ts
@@ -0,0 +1,48 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+export class InlineObject {
+ /**
+ * Updated name of the pet
+ */
+ 'name'?: string;
+ /**
+ * Updated status of the pet
+ */
+ 'status'?: string;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "name",
+ "baseName": "name",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "status",
+ "baseName": "status",
+ "type": "string",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return InlineObject.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject1.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject1.ts
new file mode 100644
index 00000000000..10653046a11
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/InlineObject1.ts
@@ -0,0 +1,48 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+export class InlineObject1 {
+ /**
+ * Additional data to pass to server
+ */
+ 'additionalMetadata'?: string;
+ /**
+ * file to upload
+ */
+ 'file'?: HttpFile;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "additionalMetadata",
+ "baseName": "additionalMetadata",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "file",
+ "baseName": "file",
+ "type": "HttpFile",
+ "format": "binary"
+ } ];
+
+ static getAttributeTypeMap() {
+ return InlineObject1.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts
new file mode 100644
index 00000000000..2f2d7cb2b69
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts
@@ -0,0 +1,240 @@
+export * from './ApiResponse.ts';
+export * from './Category.ts';
+export * from './InlineObject.ts';
+export * from './InlineObject1.ts';
+export * from './Order.ts';
+export * from './Pet.ts';
+export * from './Tag.ts';
+export * from './User.ts';
+
+import { ApiResponse } from './ApiResponse.ts';
+import { Category } from './Category.ts';
+import { InlineObject } from './InlineObject.ts';
+import { InlineObject1 } from './InlineObject1.ts';
+import { Order , OrderStatusEnum } from './Order.ts';
+import { Pet , PetStatusEnum } from './Pet.ts';
+import { Tag } from './Tag.ts';
+import { User } from './User.ts';
+
+/* tslint:disable:no-unused-variable */
+let primitives = [
+ "string",
+ "boolean",
+ "double",
+ "integer",
+ "long",
+ "float",
+ "number",
+ "any"
+ ];
+
+const supportedMediaTypes: { [mediaType: string]: number } = {
+ "application/json": Infinity,
+ "application/octet-stream": 0
+}
+
+
+let enumsMap: Set = new Set([
+ "OrderStatusEnum",
+ "PetStatusEnum",
+]);
+
+let typeMap: {[index: string]: any} = {
+ "ApiResponse": ApiResponse,
+ "Category": Category,
+ "InlineObject": InlineObject,
+ "InlineObject1": InlineObject1,
+ "Order": Order,
+ "Pet": Pet,
+ "Tag": Tag,
+ "User": User,
+}
+
+export class ObjectSerializer {
+ public static findCorrectType(data: any, expectedType: string) {
+ if (data == undefined) {
+ return expectedType;
+ } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
+ return expectedType;
+ } else if (expectedType === "Date") {
+ return expectedType;
+ } else {
+ if (enumsMap.has(expectedType)) {
+ return expectedType;
+ }
+
+ if (!typeMap[expectedType]) {
+ return expectedType; // w/e we don't know the type
+ }
+
+ // Check the discriminator
+ let discriminatorProperty = typeMap[expectedType].discriminator;
+ if (discriminatorProperty == null) {
+ return expectedType; // the type does not have a discriminator. use it.
+ } else {
+ if (data[discriminatorProperty]) {
+ var discriminatorType = data[discriminatorProperty];
+ if(typeMap[discriminatorType]){
+ return discriminatorType; // use the type given in the discriminator
+ } else {
+ return expectedType; // discriminator did not map to a type
+ }
+ } else {
+ return expectedType; // discriminator was not present (or an empty string)
+ }
+ }
+ }
+ }
+
+ public static serialize(data: any, type: string, format: string) {
+ if (data == undefined) {
+ return data;
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
+ return data;
+ } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
+ let subType: string = type.replace("Array<", ""); // Array => Type>
+ subType = subType.substring(0, subType.length - 1); // Type> => Type
+ let transformedData: any[] = [];
+ for (let index in data) {
+ let date = data[index];
+ transformedData.push(ObjectSerializer.serialize(date, subType, format));
+ }
+ return transformedData;
+ } else if (type === "Date") {
+ if (format == "date") {
+ let month = data.getMonth()+1
+ month = month < 10 ? "0" + month.toString() : month.toString()
+ let day = data.getDate();
+ day = day < 10 ? "0" + day.toString() : day.toString();
+
+ return data.getFullYear() + "-" + month + "-" + day;
+ } else {
+ return data.toISOString();
+ }
+ } else {
+ if (enumsMap.has(type)) {
+ return data;
+ }
+ if (!typeMap[type]) { // in case we dont know the type
+ return data;
+ }
+
+ // Get the actual type of this object
+ type = this.findCorrectType(data, type);
+
+ // get the map for the correct type.
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
+ let instance: {[index: string]: any} = {};
+ for (let index in attributeTypes) {
+ let attributeType = attributeTypes[index];
+ instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
+ }
+ return instance;
+ }
+ }
+
+ public static deserialize(data: any, type: string, format: string) {
+ // polymorphism may change the actual type.
+ type = ObjectSerializer.findCorrectType(data, type);
+ if (data == undefined) {
+ return data;
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
+ return data;
+ } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
+ let subType: string = type.replace("Array<", ""); // Array => Type>
+ subType = subType.substring(0, subType.length - 1); // Type> => Type
+ let transformedData: any[] = [];
+ for (let index in data) {
+ let date = data[index];
+ transformedData.push(ObjectSerializer.deserialize(date, subType, format));
+ }
+ return transformedData;
+ } else if (type === "Date") {
+ return new Date(data);
+ } else {
+ if (enumsMap.has(type)) {// is Enum
+ return data;
+ }
+
+ if (!typeMap[type]) { // dont know the type
+ return data;
+ }
+ let instance = new typeMap[type]();
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
+ for (let index in attributeTypes) {
+ let attributeType = attributeTypes[index];
+ instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
+ }
+ return instance;
+ }
+ }
+
+
+ /**
+ * Normalize media type
+ *
+ * We currently do not handle any media types attributes, i.e. anything
+ * after a semicolon. All content is assumed to be UTF-8 compatible.
+ */
+ public static normalizeMediaType(mediaType: string | undefined): string | undefined {
+ if (mediaType === undefined) {
+ return undefined;
+ }
+ return mediaType.split(";")[0].trim().toLowerCase();
+ }
+
+ /**
+ * From a list of possible media types, choose the one we can handle best.
+ *
+ * The order of the given media types does not have any impact on the choice
+ * made.
+ */
+ public static getPreferredMediaType(mediaTypes: Array): string {
+ /** According to OAS 3 we should default to json */
+ if (!mediaTypes) {
+ return "application/json";
+ }
+
+ const normalMediaTypes = mediaTypes.map(this.normalizeMediaType);
+ let selectedMediaType: string | undefined = undefined;
+ let selectedRank: number = -Infinity;
+ for (const mediaType of normalMediaTypes) {
+ if (supportedMediaTypes[mediaType!] > selectedRank) {
+ selectedMediaType = mediaType;
+ selectedRank = supportedMediaTypes[mediaType!];
+ }
+ }
+
+ if (selectedMediaType === undefined) {
+ throw new Error("None of the given media types are supported: " + mediaTypes.join(", "));
+ }
+
+ return selectedMediaType!;
+ }
+
+ /**
+ * Convert data to a string according the given media type
+ */
+ public static stringify(data: any, mediaType: string): string {
+ if (mediaType === "application/json") {
+ return JSON.stringify(data);
+ }
+
+ throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify.");
+ }
+
+ /**
+ * Parse data from a string according to the given media type
+ */
+ public static parse(rawData: string, mediaType: string | undefined) {
+ if (mediaType === undefined) {
+ throw new Error("Cannot parse content. No Content-Type defined.");
+ }
+
+ if (mediaType === "application/json") {
+ return JSON.parse(rawData);
+ }
+
+ throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
+ }
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts
new file mode 100644
index 00000000000..704d6950aee
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts
@@ -0,0 +1,79 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+/**
+* An order for a pets from the pet store
+*/
+export class Order {
+ 'id'?: number;
+ 'petId'?: number;
+ 'quantity'?: number;
+ 'shipDate'?: Date;
+ /**
+ * Order Status
+ */
+ 'status'?: OrderStatusEnum;
+ 'complete'?: boolean;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "id",
+ "baseName": "id",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "petId",
+ "baseName": "petId",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "quantity",
+ "baseName": "quantity",
+ "type": "number",
+ "format": "int32"
+ },
+ {
+ "name": "shipDate",
+ "baseName": "shipDate",
+ "type": "Date",
+ "format": "date-time"
+ },
+ {
+ "name": "status",
+ "baseName": "status",
+ "type": "OrderStatusEnum",
+ "format": ""
+ },
+ {
+ "name": "complete",
+ "baseName": "complete",
+ "type": "boolean",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return Order.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
+
+export type OrderStatusEnum = "placed" | "approved" | "delivered" ;
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts
new file mode 100644
index 00000000000..9ff2f9da286
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts
@@ -0,0 +1,81 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { Category } from './Category.ts';
+import { Tag } from './Tag.ts';
+import { HttpFile } from '../http/http.ts';
+
+/**
+* A pet for sale in the pet store
+*/
+export class Pet {
+ 'id'?: number;
+ 'category'?: Category;
+ 'name': string;
+ 'photoUrls': Array;
+ 'tags'?: Array;
+ /**
+ * pet status in the store
+ */
+ 'status'?: PetStatusEnum;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "id",
+ "baseName": "id",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "category",
+ "baseName": "category",
+ "type": "Category",
+ "format": ""
+ },
+ {
+ "name": "name",
+ "baseName": "name",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "photoUrls",
+ "baseName": "photoUrls",
+ "type": "Array",
+ "format": ""
+ },
+ {
+ "name": "tags",
+ "baseName": "tags",
+ "type": "Array",
+ "format": ""
+ },
+ {
+ "name": "status",
+ "baseName": "status",
+ "type": "PetStatusEnum",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return Pet.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
+
+export type PetStatusEnum = "available" | "pending" | "sold" ;
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts
new file mode 100644
index 00000000000..da5eec22179
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts
@@ -0,0 +1,45 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+/**
+* A tag for a pet
+*/
+export class Tag {
+ 'id'?: number;
+ 'name'?: string;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "id",
+ "baseName": "id",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "name",
+ "baseName": "name",
+ "type": "string",
+ "format": ""
+ } ];
+
+ static getAttributeTypeMap() {
+ return Tag.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts
new file mode 100644
index 00000000000..e52f4e4c56b
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts
@@ -0,0 +1,90 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { HttpFile } from '../http/http.ts';
+
+/**
+* A User who is purchasing from the pet store
+*/
+export class User {
+ 'id'?: number;
+ 'username'?: string;
+ 'firstName'?: string;
+ 'lastName'?: string;
+ 'email'?: string;
+ 'password'?: string;
+ 'phone'?: string;
+ /**
+ * User Status
+ */
+ 'userStatus'?: number;
+
+ static readonly discriminator: string | undefined = undefined;
+
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
+ {
+ "name": "id",
+ "baseName": "id",
+ "type": "number",
+ "format": "int64"
+ },
+ {
+ "name": "username",
+ "baseName": "username",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "firstName",
+ "baseName": "firstName",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "lastName",
+ "baseName": "lastName",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "email",
+ "baseName": "email",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "password",
+ "baseName": "password",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "phone",
+ "baseName": "phone",
+ "type": "string",
+ "format": ""
+ },
+ {
+ "name": "userStatus",
+ "baseName": "userStatus",
+ "type": "number",
+ "format": "int32"
+ } ];
+
+ static getAttributeTypeMap() {
+ return User.attributeTypeMap;
+ }
+
+ public constructor() {
+ }
+}
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/all.ts
new file mode 100644
index 00000000000..349080a7208
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/all.ts
@@ -0,0 +1,8 @@
+export * from './ApiResponse.ts'
+export * from './Category.ts'
+export * from './InlineObject.ts'
+export * from './InlineObject1.ts'
+export * from './Order.ts'
+export * from './Pet.ts'
+export * from './Tag.ts'
+export * from './User.ts'
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/rxjsStub.ts b/samples/openapi3/client/petstore/typescript/builds/deno/rxjsStub.ts
new file mode 100644
index 00000000000..4c73715a248
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/rxjsStub.ts
@@ -0,0 +1,27 @@
+export class Observable {
+ constructor(private promise: Promise) {}
+
+ toPromise() {
+ return this.promise;
+ }
+
+ pipe(callback: (value: T) => S | Promise): Observable {
+ return new Observable(this.promise.then(callback));
+ }
+}
+
+export function from(promise: Promise) {
+ return new Observable(promise);
+}
+
+export function of(value: T) {
+ return new Observable(Promise.resolve(value));
+}
+
+export function mergeMap(callback: (value: T) => Observable) {
+ return (value: T) => callback(value).toPromise();
+}
+
+export function map(callback: any) {
+ return callback;
+}
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts b/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts
new file mode 100644
index 00000000000..a5beeda1dec
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts
@@ -0,0 +1,53 @@
+import { RequestContext, HttpMethod } from "./http/http.ts";
+
+export interface BaseServerConfiguration {
+ makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext;
+}
+
+/**
+ *
+ * Represents the configuration of a server including its
+ * url template and variable configuration based on the url.
+ *
+ */
+export class ServerConfiguration implements BaseServerConfiguration {
+ public constructor(private url: string, private variableConfiguration: T) {}
+
+ /**
+ * Sets the value of the variables of this server.
+ *
+ * @param variableConfiguration a partial variable configuration for the variables contained in the url
+ */
+ public setVariables(variableConfiguration: Partial) {
+ Object.assign(this.variableConfiguration, variableConfiguration);
+ }
+
+ public getConfiguration(): T {
+ return this.variableConfiguration
+ }
+
+ private getUrl() {
+ let replacedUrl = this.url;
+ for (const key in this.variableConfiguration) {
+ var re = new RegExp("{" + key + "}","g");
+ replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]);
+ }
+ return replacedUrl
+ }
+
+ /**
+ * Creates a new request context for this server using the url with variables
+ * replaced with their respective values and the endpoint of the request appended.
+ *
+ * @param endpoint the endpoint to be queried on the server
+ * @param httpMethod httpMethod to be used
+ *
+ */
+ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext {
+ return new RequestContext(this.getUrl() + endpoint, httpMethod);
+ }
+}
+
+export const server1 = new ServerConfiguration<{ }>("http://petstore.swagger.io/v2", { })
+
+export const servers = [server1];
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts
new file mode 100644
index 00000000000..b6703599614
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts
@@ -0,0 +1,442 @@
+import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts';
+import * as models from '../models/all.ts';
+import { Configuration} from '../configuration.ts'
+
+import { ApiResponse } from '../models/ApiResponse.ts';
+import { Category } from '../models/Category.ts';
+import { InlineObject } from '../models/InlineObject.ts';
+import { InlineObject1 } from '../models/InlineObject1.ts';
+import { Order } from '../models/Order.ts';
+import { Pet } from '../models/Pet.ts';
+import { Tag } from '../models/Tag.ts';
+import { User } from '../models/User.ts';
+
+import { ObservablePetApi } from "./ObservableAPI.ts";
+import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi.ts";
+
+export interface PetApiAddPetRequest {
+ /**
+ * Pet object that needs to be added to the store
+ * @type Pet
+ * @memberof PetApiaddPet
+ */
+ pet: Pet
+}
+
+export interface PetApiDeletePetRequest {
+ /**
+ * Pet id to delete
+ * @type number
+ * @memberof PetApideletePet
+ */
+ petId: number
+ /**
+ *
+ * @type string
+ * @memberof PetApideletePet
+ */
+ apiKey?: string
+}
+
+export interface PetApiFindPetsByStatusRequest {
+ /**
+ * Status values that need to be considered for filter
+ * @type Array<'available' | 'pending' | 'sold'>
+ * @memberof PetApifindPetsByStatus
+ */
+ status: Array<'available' | 'pending' | 'sold'>
+}
+
+export interface PetApiFindPetsByTagsRequest {
+ /**
+ * Tags to filter by
+ * @type Array<string>
+ * @memberof PetApifindPetsByTags
+ */
+ tags: Array
+}
+
+export interface PetApiGetPetByIdRequest {
+ /**
+ * ID of pet to return
+ * @type number
+ * @memberof PetApigetPetById
+ */
+ petId: number
+}
+
+export interface PetApiUpdatePetRequest {
+ /**
+ * Pet object that needs to be added to the store
+ * @type Pet
+ * @memberof PetApiupdatePet
+ */
+ pet: Pet
+}
+
+export interface PetApiUpdatePetWithFormRequest {
+ /**
+ * ID of pet that needs to be updated
+ * @type number
+ * @memberof PetApiupdatePetWithForm
+ */
+ petId: number
+ /**
+ * Updated name of the pet
+ * @type string
+ * @memberof PetApiupdatePetWithForm
+ */
+ name?: string
+ /**
+ * Updated status of the pet
+ * @type string
+ * @memberof PetApiupdatePetWithForm
+ */
+ status?: string
+}
+
+export interface PetApiUploadFileRequest {
+ /**
+ * ID of pet to update
+ * @type number
+ * @memberof PetApiuploadFile
+ */
+ petId: number
+ /**
+ * Additional data to pass to server
+ * @type string
+ * @memberof PetApiuploadFile
+ */
+ additionalMetadata?: string
+ /**
+ * file to upload
+ * @type HttpFile
+ * @memberof PetApiuploadFile
+ */
+ file?: HttpFile
+}
+
+
+export class ObjectPetApi {
+ private api: ObservablePetApi
+
+ public constructor(configuration: Configuration, requestFactory?: PetApiRequestFactory, responseProcessor?: PetApiResponseProcessor) {
+ this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * Add a new pet to the store
+ * @param param the request object
+ */
+ public addPet(param: PetApiAddPetRequest, options?: Configuration): Promise {
+ return this.api.addPet(param.pet, options).toPromise();
+ }
+
+ /**
+ * Deletes a pet
+ * @param param the request object
+ */
+ public deletePet(param: PetApiDeletePetRequest, options?: Configuration): Promise {
+ return this.api.deletePet(param.petId, param.apiKey, options).toPromise();
+ }
+
+ /**
+ * Multiple status values can be provided with comma separated strings
+ * Finds Pets by status
+ * @param param the request object
+ */
+ public findPetsByStatus(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise> {
+ return this.api.findPetsByStatus(param.status, options).toPromise();
+ }
+
+ /**
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * Finds Pets by tags
+ * @param param the request object
+ */
+ public findPetsByTags(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise> {
+ return this.api.findPetsByTags(param.tags, options).toPromise();
+ }
+
+ /**
+ * Returns a single pet
+ * Find pet by ID
+ * @param param the request object
+ */
+ public getPetById(param: PetApiGetPetByIdRequest, options?: Configuration): Promise {
+ return this.api.getPetById(param.petId, options).toPromise();
+ }
+
+ /**
+ * Update an existing pet
+ * @param param the request object
+ */
+ public updatePet(param: PetApiUpdatePetRequest, options?: Configuration): Promise {
+ return this.api.updatePet(param.pet, options).toPromise();
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ * @param param the request object
+ */
+ public updatePetWithForm(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise {
+ return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise();
+ }
+
+ /**
+ * uploads an image
+ * @param param the request object
+ */
+ public uploadFile(param: PetApiUploadFileRequest, options?: Configuration): Promise {
+ return this.api.uploadFile(param.petId, param.additionalMetadata, param.file, options).toPromise();
+ }
+
+
+}
+
+
+
+
+import { ObservableStoreApi } from "./ObservableAPI.ts";
+import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi.ts";
+
+export interface StoreApiDeleteOrderRequest {
+ /**
+ * ID of the order that needs to be deleted
+ * @type string
+ * @memberof StoreApideleteOrder
+ */
+ orderId: string
+}
+
+export interface StoreApiGetInventoryRequest {
+}
+
+export interface StoreApiGetOrderByIdRequest {
+ /**
+ * ID of pet that needs to be fetched
+ * @type number
+ * @memberof StoreApigetOrderById
+ */
+ orderId: number
+}
+
+export interface StoreApiPlaceOrderRequest {
+ /**
+ * order placed for purchasing the pet
+ * @type Order
+ * @memberof StoreApiplaceOrder
+ */
+ order: Order
+}
+
+
+export class ObjectStoreApi {
+ private api: ObservableStoreApi
+
+ public constructor(configuration: Configuration, requestFactory?: StoreApiRequestFactory, responseProcessor?: StoreApiResponseProcessor) {
+ this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * Delete purchase order by ID
+ * @param param the request object
+ */
+ public deleteOrder(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise {
+ return this.api.deleteOrder(param.orderId, options).toPromise();
+ }
+
+ /**
+ * Returns a map of status codes to quantities
+ * Returns pet inventories by status
+ * @param param the request object
+ */
+ public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
+ return this.api.getInventory( options).toPromise();
+ }
+
+ /**
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * Find purchase order by ID
+ * @param param the request object
+ */
+ public getOrderById(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise {
+ return this.api.getOrderById(param.orderId, options).toPromise();
+ }
+
+ /**
+ * Place an order for a pet
+ * @param param the request object
+ */
+ public placeOrder(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise {
+ return this.api.placeOrder(param.order, options).toPromise();
+ }
+
+
+}
+
+
+
+
+import { ObservableUserApi } from "./ObservableAPI.ts";
+import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi.ts";
+
+export interface UserApiCreateUserRequest {
+ /**
+ * Created user object
+ * @type User
+ * @memberof UserApicreateUser
+ */
+ user: User
+}
+
+export interface UserApiCreateUsersWithArrayInputRequest {
+ /**
+ * List of user object
+ * @type Array<User>
+ * @memberof UserApicreateUsersWithArrayInput
+ */
+ user: Array
+}
+
+export interface UserApiCreateUsersWithListInputRequest {
+ /**
+ * List of user object
+ * @type Array<User>
+ * @memberof UserApicreateUsersWithListInput
+ */
+ user: Array
+}
+
+export interface UserApiDeleteUserRequest {
+ /**
+ * The name that needs to be deleted
+ * @type string
+ * @memberof UserApideleteUser
+ */
+ username: string
+}
+
+export interface UserApiGetUserByNameRequest {
+ /**
+ * The name that needs to be fetched. Use user1 for testing.
+ * @type string
+ * @memberof UserApigetUserByName
+ */
+ username: string
+}
+
+export interface UserApiLoginUserRequest {
+ /**
+ * The user name for login
+ * @type string
+ * @memberof UserApiloginUser
+ */
+ username: string
+ /**
+ * The password for login in clear text
+ * @type string
+ * @memberof UserApiloginUser
+ */
+ password: string
+}
+
+export interface UserApiLogoutUserRequest {
+}
+
+export interface UserApiUpdateUserRequest {
+ /**
+ * name that need to be deleted
+ * @type string
+ * @memberof UserApiupdateUser
+ */
+ username: string
+ /**
+ * Updated user object
+ * @type User
+ * @memberof UserApiupdateUser
+ */
+ user: User
+}
+
+
+export class ObjectUserApi {
+ private api: ObservableUserApi
+
+ public constructor(configuration: Configuration, requestFactory?: UserApiRequestFactory, responseProcessor?: UserApiResponseProcessor) {
+ this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Create user
+ * @param param the request object
+ */
+ public createUser(param: UserApiCreateUserRequest, options?: Configuration): Promise {
+ return this.api.createUser(param.user, options).toPromise();
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param param the request object
+ */
+ public createUsersWithArrayInput(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise {
+ return this.api.createUsersWithArrayInput(param.user, options).toPromise();
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param param the request object
+ */
+ public createUsersWithListInput(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise {
+ return this.api.createUsersWithListInput(param.user, options).toPromise();
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Delete user
+ * @param param the request object
+ */
+ public deleteUser(param: UserApiDeleteUserRequest, options?: Configuration): Promise {
+ return this.api.deleteUser(param.username, options).toPromise();
+ }
+
+ /**
+ * Get user by user name
+ * @param param the request object
+ */
+ public getUserByName(param: UserApiGetUserByNameRequest, options?: Configuration): Promise {
+ return this.api.getUserByName(param.username, options).toPromise();
+ }
+
+ /**
+ * Logs user into the system
+ * @param param the request object
+ */
+ public loginUser(param: UserApiLoginUserRequest, options?: Configuration): Promise {
+ return this.api.loginUser(param.username, param.password, options).toPromise();
+ }
+
+ /**
+ * Logs out current logged in user session
+ * @param param the request object
+ */
+ public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise {
+ return this.api.logoutUser( options).toPromise();
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Updated user
+ * @param param the request object
+ */
+ public updateUser(param: UserApiUpdateUserRequest, options?: Configuration): Promise {
+ return this.api.updateUser(param.username, param.user, options).toPromise();
+ }
+
+
+}
+
+
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts
new file mode 100644
index 00000000000..c9c5604992c
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts
@@ -0,0 +1,554 @@
+import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts';
+import * as models from '../models/all.ts';
+import { Configuration} from '../configuration.ts'
+import { Observable, of, from } from '../rxjsStub.ts';
+import {mergeMap, map} from '../rxjsStub.ts';
+
+import { ApiResponse } from '../models/ApiResponse.ts';
+import { Category } from '../models/Category.ts';
+import { InlineObject } from '../models/InlineObject.ts';
+import { InlineObject1 } from '../models/InlineObject1.ts';
+import { Order } from '../models/Order.ts';
+import { Pet } from '../models/Pet.ts';
+import { Tag } from '../models/Tag.ts';
+import { User } from '../models/User.ts';
+
+import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi.ts";
+export class ObservablePetApi {
+ private requestFactory: PetApiRequestFactory;
+ private responseProcessor: PetApiResponseProcessor;
+ private configuration: Configuration;
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: PetApiRequestFactory,
+ responseProcessor?: PetApiResponseProcessor
+ ) {
+ this.configuration = configuration;
+ this.requestFactory = requestFactory || new PetApiRequestFactory(configuration);
+ this.responseProcessor = responseProcessor || new PetApiResponseProcessor();
+ }
+
+ /**
+ * Add a new pet to the store
+ * @param pet Pet object that needs to be added to the store
+ */
+ public addPet(pet: Pet, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.addPet(pet, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp)));
+ }));
+ }
+
+ /**
+ * Deletes a pet
+ * @param petId Pet id to delete
+ * @param apiKey
+ */
+ public deletePet(petId: number, apiKey?: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp)));
+ }));
+ }
+
+ /**
+ * Multiple status values can be provided with comma separated strings
+ * Finds Pets by status
+ * @param status Status values that need to be considered for filter
+ */
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: Configuration): Observable> {
+ const requestContextPromise = this.requestFactory.findPetsByStatus(status, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp)));
+ }));
+ }
+
+ /**
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * Finds Pets by tags
+ * @param tags Tags to filter by
+ */
+ public findPetsByTags(tags: Array, options?: Configuration): Observable> {
+ const requestContextPromise = this.requestFactory.findPetsByTags(tags, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp)));
+ }));
+ }
+
+ /**
+ * Returns a single pet
+ * Find pet by ID
+ * @param petId ID of pet to return
+ */
+ public getPetById(petId: number, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.getPetById(petId, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp)));
+ }));
+ }
+
+ /**
+ * Update an existing pet
+ * @param pet Pet object that needs to be added to the store
+ */
+ public updatePet(pet: Pet, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.updatePet(pet, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp)));
+ }));
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ */
+ public updatePetWithForm(petId: number, name?: string, status?: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp)));
+ }));
+ }
+
+ /**
+ * uploads an image
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server
+ * @param file file to upload
+ */
+ public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp)));
+ }));
+ }
+
+
+}
+
+
+
+
+import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi.ts";
+export class ObservableStoreApi {
+ private requestFactory: StoreApiRequestFactory;
+ private responseProcessor: StoreApiResponseProcessor;
+ private configuration: Configuration;
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: StoreApiRequestFactory,
+ responseProcessor?: StoreApiResponseProcessor
+ ) {
+ this.configuration = configuration;
+ this.requestFactory = requestFactory || new StoreApiRequestFactory(configuration);
+ this.responseProcessor = responseProcessor || new StoreApiResponseProcessor();
+ }
+
+ /**
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * Delete purchase order by ID
+ * @param orderId ID of the order that needs to be deleted
+ */
+ public deleteOrder(orderId: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.deleteOrder(orderId, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp)));
+ }));
+ }
+
+ /**
+ * Returns a map of status codes to quantities
+ * Returns pet inventories by status
+ */
+ public getInventory(options?: Configuration): Observable<{ [key: string]: number; }> {
+ const requestContextPromise = this.requestFactory.getInventory(options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp)));
+ }));
+ }
+
+ /**
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * Find purchase order by ID
+ * @param orderId ID of pet that needs to be fetched
+ */
+ public getOrderById(orderId: number, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.getOrderById(orderId, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp)));
+ }));
+ }
+
+ /**
+ * Place an order for a pet
+ * @param order order placed for purchasing the pet
+ */
+ public placeOrder(order: Order, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.placeOrder(order, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp)));
+ }));
+ }
+
+
+}
+
+
+
+
+import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi.ts";
+export class ObservableUserApi {
+ private requestFactory: UserApiRequestFactory;
+ private responseProcessor: UserApiResponseProcessor;
+ private configuration: Configuration;
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: UserApiRequestFactory,
+ responseProcessor?: UserApiResponseProcessor
+ ) {
+ this.configuration = configuration;
+ this.requestFactory = requestFactory || new UserApiRequestFactory(configuration);
+ this.responseProcessor = responseProcessor || new UserApiResponseProcessor();
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Create user
+ * @param user Created user object
+ */
+ public createUser(user: User, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.createUser(user, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp)));
+ }));
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public createUsersWithArrayInput(user: Array, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp)));
+ }));
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public createUsersWithListInput(user: Array, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.createUsersWithListInput(user, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp)));
+ }));
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Delete user
+ * @param username The name that needs to be deleted
+ */
+ public deleteUser(username: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.deleteUser(username, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp)));
+ }));
+ }
+
+ /**
+ * Get user by user name
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ public getUserByName(username: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.getUserByName(username, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp)));
+ }));
+ }
+
+ /**
+ * Logs user into the system
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ public loginUser(username: string, password: string, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.loginUser(username, password, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp)));
+ }));
+ }
+
+ /**
+ * Logs out current logged in user session
+ */
+ public logoutUser(options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.logoutUser(options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp)));
+ }));
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Updated user
+ * @param username name that need to be deleted
+ * @param user Updated user object
+ */
+ public updateUser(username: string, user: User, options?: Configuration): Observable {
+ const requestContextPromise = this.requestFactory.updateUser(username, user, options);
+
+ // build promise chain
+ let middlewarePreObservable = from(requestContextPromise);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx)));
+ }
+
+ return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))).
+ pipe(mergeMap((response: ResponseContext) => {
+ let middlewarePostObservable = of(response);
+ for (let middleware of this.configuration.middleware) {
+ middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp)));
+ }
+ return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp)));
+ }));
+ }
+
+
+}
+
+
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts
new file mode 100644
index 00000000000..ea458404f92
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts
@@ -0,0 +1,266 @@
+import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts';
+import * as models from '../models/all.ts';
+import { Configuration} from '../configuration.ts'
+
+import { ApiResponse } from '../models/ApiResponse.ts';
+import { Category } from '../models/Category.ts';
+import { InlineObject } from '../models/InlineObject.ts';
+import { InlineObject1 } from '../models/InlineObject1.ts';
+import { Order } from '../models/Order.ts';
+import { Pet } from '../models/Pet.ts';
+import { Tag } from '../models/Tag.ts';
+import { User } from '../models/User.ts';
+import { ObservablePetApi } from './ObservableAPI.ts';
+
+
+import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi.ts";
+export class PromisePetApi {
+ private api: ObservablePetApi
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: PetApiRequestFactory,
+ responseProcessor?: PetApiResponseProcessor
+ ) {
+ this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * Add a new pet to the store
+ * @param pet Pet object that needs to be added to the store
+ */
+ public addPet(pet: Pet, options?: Configuration): Promise {
+ const result = this.api.addPet(pet, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Deletes a pet
+ * @param petId Pet id to delete
+ * @param apiKey
+ */
+ public deletePet(petId: number, apiKey?: string, options?: Configuration): Promise {
+ const result = this.api.deletePet(petId, apiKey, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Multiple status values can be provided with comma separated strings
+ * Finds Pets by status
+ * @param status Status values that need to be considered for filter
+ */
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: Configuration): Promise> {
+ const result = this.api.findPetsByStatus(status, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * Finds Pets by tags
+ * @param tags Tags to filter by
+ */
+ public findPetsByTags(tags: Array, options?: Configuration): Promise> {
+ const result = this.api.findPetsByTags(tags, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Returns a single pet
+ * Find pet by ID
+ * @param petId ID of pet to return
+ */
+ public getPetById(petId: number, options?: Configuration): Promise {
+ const result = this.api.getPetById(petId, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Update an existing pet
+ * @param pet Pet object that needs to be added to the store
+ */
+ public updatePet(pet: Pet, options?: Configuration): Promise {
+ const result = this.api.updatePet(pet, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ */
+ public updatePetWithForm(petId: number, name?: string, status?: string, options?: Configuration): Promise {
+ const result = this.api.updatePetWithForm(petId, name, status, options);
+ return result.toPromise();
+ }
+
+ /**
+ * uploads an image
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server
+ * @param file file to upload
+ */
+ public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, options?: Configuration): Promise {
+ const result = this.api.uploadFile(petId, additionalMetadata, file, options);
+ return result.toPromise();
+ }
+
+
+}
+
+
+
+import { ObservableStoreApi } from './ObservableAPI.ts';
+
+
+import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi.ts";
+export class PromiseStoreApi {
+ private api: ObservableStoreApi
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: StoreApiRequestFactory,
+ responseProcessor?: StoreApiResponseProcessor
+ ) {
+ this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * Delete purchase order by ID
+ * @param orderId ID of the order that needs to be deleted
+ */
+ public deleteOrder(orderId: string, options?: Configuration): Promise {
+ const result = this.api.deleteOrder(orderId, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Returns a map of status codes to quantities
+ * Returns pet inventories by status
+ */
+ public getInventory(options?: Configuration): Promise<{ [key: string]: number; }> {
+ const result = this.api.getInventory(options);
+ return result.toPromise();
+ }
+
+ /**
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * Find purchase order by ID
+ * @param orderId ID of pet that needs to be fetched
+ */
+ public getOrderById(orderId: number, options?: Configuration): Promise {
+ const result = this.api.getOrderById(orderId, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Place an order for a pet
+ * @param order order placed for purchasing the pet
+ */
+ public placeOrder(order: Order, options?: Configuration): Promise {
+ const result = this.api.placeOrder(order, options);
+ return result.toPromise();
+ }
+
+
+}
+
+
+
+import { ObservableUserApi } from './ObservableAPI.ts';
+
+
+import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi.ts";
+export class PromiseUserApi {
+ private api: ObservableUserApi
+
+ public constructor(
+ configuration: Configuration,
+ requestFactory?: UserApiRequestFactory,
+ responseProcessor?: UserApiResponseProcessor
+ ) {
+ this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor);
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Create user
+ * @param user Created user object
+ */
+ public createUser(user: User, options?: Configuration): Promise {
+ const result = this.api.createUser(user, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public createUsersWithArrayInput(user: Array, options?: Configuration): Promise {
+ const result = this.api.createUsersWithArrayInput(user, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Creates list of users with given input array
+ * @param user List of user object
+ */
+ public createUsersWithListInput(user: Array, options?: Configuration): Promise {
+ const result = this.api.createUsersWithListInput(user, options);
+ return result.toPromise();
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Delete user
+ * @param username The name that needs to be deleted
+ */
+ public deleteUser(username: string, options?: Configuration): Promise {
+ const result = this.api.deleteUser(username, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Get user by user name
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ public getUserByName(username: string, options?: Configuration): Promise {
+ const result = this.api.getUserByName(username, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Logs user into the system
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ public loginUser(username: string, password: string, options?: Configuration): Promise {
+ const result = this.api.loginUser(username, password, options);
+ return result.toPromise();
+ }
+
+ /**
+ * Logs out current logged in user session
+ */
+ public logoutUser(options?: Configuration): Promise {
+ const result = this.api.logoutUser(options);
+ return result.toPromise();
+ }
+
+ /**
+ * This can only be done by the logged in user.
+ * Updated user
+ * @param username name that need to be deleted
+ * @param user Updated user object
+ */
+ public updateUser(username: string, user: User, options?: Configuration): Promise {
+ const result = this.api.updateUser(username, user, options);
+ return result.toPromise();
+ }
+
+
+}
+
+
+
diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/util.ts b/samples/openapi3/client/petstore/typescript/builds/deno/util.ts
new file mode 100644
index 00000000000..d1888434535
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/builds/deno/util.ts
@@ -0,0 +1,28 @@
+/**
+ * Returns if a specific http code is in a given code range
+ * where the code range is defined as a combination of digits
+ * and "X" (the letter X) with a length of 3
+ *
+ * @param codeRange string with length 3 consisting of digits and "X" (the letter X)
+ * @param code the http status code to be checked against the code range
+ */
+export function isCodeInRange(codeRange: string, code: number): boolean {
+ // This is how the default value is encoded in OAG
+ if (codeRange === "0") {
+ return true;
+ }
+ if (codeRange == code.toString()) {
+ return true;
+ } else {
+ const codeString = code.toString();
+ if (codeString.length != codeRange.length) {
+ return false;
+ }
+ for (let i = 0; i < codeString.length; i++) {
+ if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts
index ac32e72aa98..4241ca3d329 100644
--- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts
@@ -57,7 +57,7 @@ export class RequestContext {
* @param httpMethod http method
*/
public constructor(url: string, private httpMethod: HttpMethod) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/*
@@ -73,7 +73,7 @@ export class RequestContext {
*
*/
public setUrl(url: string) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/**
diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts
index 25bd41db1a8..ddf4ed98b1d 100644
--- a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts
@@ -1,5 +1,3 @@
-import "es6-promise/auto";
-
export * from "./http/http";
export * from "./auth/auth";
export * from "./models/all";
diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts
index 637e96f38a7..a3207336003 100644
--- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts
@@ -52,7 +52,7 @@ export class RequestContext {
* @param httpMethod http method
*/
public constructor(url: string, private httpMethod: HttpMethod) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/*
@@ -68,7 +68,7 @@ export class RequestContext {
*
*/
public setUrl(url: string) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/**
diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts
index cbc24ba3554..fe00e36cbd8 100644
--- a/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts
@@ -1,5 +1,3 @@
-import "es6-promise/auto";
-
export * from "./http/http";
export * from "./auth/auth";
export * from "./models/all";
diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts
index ac32e72aa98..4241ca3d329 100644
--- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts
@@ -57,7 +57,7 @@ export class RequestContext {
* @param httpMethod http method
*/
public constructor(url: string, private httpMethod: HttpMethod) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/*
@@ -73,7 +73,7 @@ export class RequestContext {
*
*/
public setUrl(url: string) {
- this.url = URLParse(url, true);
+ this.url = new URLParse(url, true);
}
/**
diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts
index 810dddcbef2..e3944796cfe 100644
--- a/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts
+++ b/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts
@@ -1,5 +1,3 @@
-import "es6-promise/auto";
-
export * from "./http/http";
export * from "./auth/auth";
export * from "./models/all";
diff --git a/samples/openapi3/client/petstore/typescript/tests/deno/.gitignore b/samples/openapi3/client/petstore/typescript/tests/deno/.gitignore
new file mode 100644
index 00000000000..1521c8b7652
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/tests/deno/.gitignore
@@ -0,0 +1 @@
+dist
diff --git a/samples/openapi3/client/petstore/typescript/tests/deno/pom.xml b/samples/openapi3/client/petstore/typescript/tests/deno/pom.xml
new file mode 100644
index 00000000000..bb8cca51a3f
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/tests/deno/pom.xml
@@ -0,0 +1,49 @@
+
+ 4.0.0
+ org.openapitools
+ TypeScriptDenoPetstoreClientTests
+ pom
+ 1.0-SNAPSHOT
+ TS Petstore Test Client
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+
+ deno-test
+ integration-test
+
+ exec
+
+
+ deno
+
+ test
+ --allow-net=petstore.swagger.io
+ --allow-read=.
+ test/api/PetApi_test.ts
+
+
+
+
+
+
+
+
diff --git a/samples/openapi3/client/petstore/typescript/tests/deno/test/api/PetApi_test.ts b/samples/openapi3/client/petstore/typescript/tests/deno/test/api/PetApi_test.ts
new file mode 100644
index 00000000000..9f56de86eab
--- /dev/null
+++ b/samples/openapi3/client/petstore/typescript/tests/deno/test/api/PetApi_test.ts
@@ -0,0 +1,127 @@
+import {
+ assertEquals,
+ assert,
+ fail,
+} from "https://deno.land/std@0.58.0/testing/asserts.ts";
+import * as petstore from "../../../../builds/deno/index.ts";
+
+const configuration = petstore.createConfiguration();
+const petApi = new petstore.PetApi(configuration);
+
+const tag = new petstore.Tag();
+tag.name = "tag1";
+tag.id = Math.floor(Math.random() * 100000);
+
+const pet = new petstore.Pet();
+const petId = Math.floor(Math.random() * 100000);
+pet.id = petId;
+pet.name = "PetName";
+pet.photoUrls = [];
+pet.status = "available";
+pet.tags = [tag];
+pet.category = undefined;
+
+Deno.test({
+ name: "PetApi addPet getPetById",
+ fn: async () => {
+ await petApi.addPet(pet);
+ const createdPet = await petApi.getPetById(petId);
+ assertEquals(createdPet, pet);
+ },
+});
+
+Deno.test({
+ name: "PetApi deletePet",
+ fn: async () => {
+ try {
+ await petApi.addPet(pet);
+ await petApi.deletePet(petId);
+ await petApi.getPetById(petId);
+ fail("Pet with id " + pet.id + " was not deleted!");
+ } catch (err) {
+ if (!err.code || err.code != 404) {
+ fail(err);
+ }
+ }
+ },
+ sanitizeResources: false,
+});
+
+Deno.test({
+ name: "PetApi findPetsByStatus",
+ fn: async () => {
+ try {
+ await petApi.addPet(pet);
+ const pets = await petApi.findPetsByStatus(["available"]);
+ assert(pets.length > 0);
+ } catch (err) {
+ fail(err);
+ }
+ },
+});
+
+// bugged on server side! Code 500
+/* it("findPetsByTag", (done) => {
+ petApi.addPet(pet).then(() => {
+ return petApi.findPetsByTags([tag.name])
+ }).then((pets: Pet[]) => {
+ expect(pets.length).to.be.at.least(1);
+ done();
+ }).catch((err: any) => {
+ done(err);
+ })
+ })*/
+
+Deno.test({
+ name: "PetApi updatePet",
+ fn: async () => {
+ const oldName = pet.name;
+ const updatedName = "updated name";
+ try {
+ await petApi.addPet(pet);
+ pet.name = updatedName;
+ await petApi.updatePet(pet);
+ const updatedPet = await petApi.getPetById(petId);
+ assertEquals(updatedPet.id, petId);
+ assertEquals(updatedPet.name, updatedName);
+ } catch (err) {
+ fail(err);
+ } finally {
+ pet.name = oldName;
+ }
+ },
+});
+
+// not supported by online swagger api?
+/* it("updatePetWithForm", (done) => {
+ const updatedName = "updated name";
+ petApi.addPet(pet).then(() => {
+ return petApi.updatePetWithForm(pet.id, updatedName)
+ }).then(() => {
+ return petApi.getPetById(pet.id)
+ }).then((returnedPet: Pet) => {
+ expect(returnedPet.id).to.equal(pet.id)
+ expect(returnedPet.name).to.equal(updatedName);
+ done()
+ }).catch((err: any) => {
+ done(err)
+ })
+ })*/
+
+Deno.test({
+ name: "PetApi uploadFile",
+ fn: async () => {
+ try {
+ const blob = new Blob(
+ [Deno.readFileSync("./test/api/pet.png")],
+ { type: "application/octet-binary" },
+ );
+ const file = new File([blob], "pet.png");
+ const response = await petApi.uploadFile(petId, "Metadata", file);
+ assert(response.code && response.code >= 200 && response.code < 300);
+ assert(response.message && response.message.indexOf("pet.png") >= 0);
+ } catch (err) {
+ fail(err);
+ }
+ },
+});
diff --git a/samples/openapi3/client/petstore/typescript/tests/deno/test/api/pet.png b/samples/openapi3/client/petstore/typescript/tests/deno/test/api/pet.png
new file mode 100644
index 00000000000..c9a9c49163d
Binary files /dev/null and b/samples/openapi3/client/petstore/typescript/tests/deno/test/api/pet.png differ