diff --git a/CHANGELOG.md b/CHANGELOG.md index e583f516..bdbd0114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # next release +# 5.1.2 + +Fixes: +- Linter disable rules is not working (issue #164, thanks @Haritaso) + # 5.1.1 Fixes: diff --git a/package-lock.json b/package-lock.json index 96942c8a..aadb273f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "swagger-typescript-api", - "version": "5.1.1", + "version": "5.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 034beff7..54df5d1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swagger-typescript-api", - "version": "5.1.1", + "version": "5.1.2", "description": "Create typescript api module from swagger schema", "scripts": { "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts --extract-request-params --enum-names-as-values", diff --git a/src/filePrefix.js b/src/filePrefix.js index 9bab3a85..b58d14a4 100644 --- a/src/filePrefix.js +++ b/src/filePrefix.js @@ -1,6 +1,6 @@ module.exports = { - filePrefix: `/* eslint:disable */ -/* tslint-disable */ + filePrefix: `/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/adafruit.ts b/tests/generated/v2.0/adafruit.ts index ab239510..f984028e 100644 --- a/tests/generated/v2.0/adafruit.ts +++ b/tests/generated/v2.0/adafruit.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/another-example.ts b/tests/generated/v2.0/another-example.ts index 28d669ba..0e8e4904 100644 --- a/tests/generated/v2.0/another-example.ts +++ b/tests/generated/v2.0/another-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/another-schema.ts b/tests/generated/v2.0/another-schema.ts new file mode 100644 index 00000000..07b6d0c3 --- /dev/null +++ b/tests/generated/v2.0/another-schema.ts @@ -0,0 +1,277 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Bar { + A?: string; + + /** @format int32 */ + B: number; + + /** @format date-time */ + C: string; + Baz?: Baz; +} + +export interface Baz { + /** @format decimal */ + D: number; + Color: Color; +} + +export enum Color { + RED = 0, + GREEN = 1, + BLUE = 2, +} + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: keyof Omit; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType) => RequestParams | void; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType = null as any; + private securityWorker: null | ApiConfig["securityWorker"] = null; + private abortControllers = new Map(); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType) => { + this.securityData = data; + }; + + private addQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + + return ( + encodeURIComponent(key) + + "=" + + encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`) + ); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => + typeof query[key] === "object" && !Array.isArray(query[key]) + ? this.toQueryString(query[key] as QueryParamsType) + : this.addQueryParam(query, key), + ) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => (input !== null && typeof input === "object" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((data, key) => { + data.append(key, input[key]); + return data; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = ({ + body, + secure, + path, + type, + query, + format = "json", + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + + return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + headers: { + ...(type ? { "Content-Type": type } : {}), + ...(requestParams.headers || {}), + }, + ...requestParams, + signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = (null as unknown) as T; + r.error = (null as unknown) as E; + + const data = await response[format]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title No title + */ +export class Api extends HttpClient { + api = { + /** + * No description + * + * @tags Foo + * @name FooGetBarDescriptions + * @request GET:/api/Foo/GetBarDescriptions + */ + fooGetBarDescriptions: (params: RequestParams = {}) => + this.request({ + path: `/api/Foo/GetBarDescriptions`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooGetBar + * @request GET:/api/Foo/GetBar + */ + fooGetBar: (query: { id: number }, params: RequestParams = {}) => + this.request({ + path: `/api/Foo/GetBar`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooSetBar + * @request POST:/api/Foo/SetBar + */ + fooSetBar: (value: Bar, params: RequestParams = {}) => + this.request({ + path: `/api/Foo/SetBar`, + method: "POST", + body: value, + type: ContentType.Json, + ...params, + }), + }; +} diff --git a/tests/generated/v2.0/api-with-examples.ts b/tests/generated/v2.0/api-with-examples.ts index b194a783..594a4625 100644 --- a/tests/generated/v2.0/api-with-examples.ts +++ b/tests/generated/v2.0/api-with-examples.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/authentiq.ts b/tests/generated/v2.0/authentiq.ts index 05e61505..3cd242e3 100644 --- a/tests/generated/v2.0/authentiq.ts +++ b/tests/generated/v2.0/authentiq.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/example1.ts b/tests/generated/v2.0/example1.ts index 6f0b7201..e83068e4 100644 --- a/tests/generated/v2.0/example1.ts +++ b/tests/generated/v2.0/example1.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/file-formdata-example.ts b/tests/generated/v2.0/file-formdata-example.ts index fcdf656e..3a7ebfa5 100644 --- a/tests/generated/v2.0/file-formdata-example.ts +++ b/tests/generated/v2.0/file-formdata-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/furkot-example.ts b/tests/generated/v2.0/furkot-example.ts index 1cd22851..2c78e826 100644 --- a/tests/generated/v2.0/furkot-example.ts +++ b/tests/generated/v2.0/furkot-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/giphy.ts b/tests/generated/v2.0/giphy.ts index 59a07019..6d0c273d 100644 --- a/tests/generated/v2.0/giphy.ts +++ b/tests/generated/v2.0/giphy.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/github-swagger.ts b/tests/generated/v2.0/github-swagger.ts index b948e150..83d05716 100644 --- a/tests/generated/v2.0/github-swagger.ts +++ b/tests/generated/v2.0/github-swagger.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/path-args.ts b/tests/generated/v2.0/path-args.ts index 0229cdde..75afb14e 100644 --- a/tests/generated/v2.0/path-args.ts +++ b/tests/generated/v2.0/path-args.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore-expanded.ts b/tests/generated/v2.0/petstore-expanded.ts index 0f352b5e..5c670c85 100644 --- a/tests/generated/v2.0/petstore-expanded.ts +++ b/tests/generated/v2.0/petstore-expanded.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore-minimal.ts b/tests/generated/v2.0/petstore-minimal.ts index 3e43d318..f9f4c43d 100644 --- a/tests/generated/v2.0/petstore-minimal.ts +++ b/tests/generated/v2.0/petstore-minimal.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore-simple.ts b/tests/generated/v2.0/petstore-simple.ts index d2cf17d5..2a8b1bcb 100644 --- a/tests/generated/v2.0/petstore-simple.ts +++ b/tests/generated/v2.0/petstore-simple.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore-swagger-io.ts b/tests/generated/v2.0/petstore-swagger-io.ts index de14e554..e9262428 100644 --- a/tests/generated/v2.0/petstore-swagger-io.ts +++ b/tests/generated/v2.0/petstore-swagger-io.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore-with-external-docs.ts b/tests/generated/v2.0/petstore-with-external-docs.ts index a6181f78..4fd4afb5 100644 --- a/tests/generated/v2.0/petstore-with-external-docs.ts +++ b/tests/generated/v2.0/petstore-with-external-docs.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/petstore.ts b/tests/generated/v2.0/petstore.ts index b0a7b8ac..92868214 100644 --- a/tests/generated/v2.0/petstore.ts +++ b/tests/generated/v2.0/petstore.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/query-path-param.ts b/tests/generated/v2.0/query-path-param.ts index d8f44cc4..9ef2f1c1 100644 --- a/tests/generated/v2.0/query-path-param.ts +++ b/tests/generated/v2.0/query-path-param.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v2.0/uber.ts b/tests/generated/v2.0/uber.ts index 562e7bf5..97fa85da 100644 --- a/tests/generated/v2.0/uber.ts +++ b/tests/generated/v2.0/uber.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/additional-properties.ts b/tests/generated/v3.0/additional-properties.ts index ac03248e..8c36fd69 100644 --- a/tests/generated/v3.0/additional-properties.ts +++ b/tests/generated/v3.0/additional-properties.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/additional-properties2.ts b/tests/generated/v3.0/additional-properties2.ts index af6afc8e..4ad3b6b2 100644 --- a/tests/generated/v3.0/additional-properties2.ts +++ b/tests/generated/v3.0/additional-properties2.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/allof-example.ts b/tests/generated/v3.0/allof-example.ts index 87e8afa0..a1d9fed8 100644 --- a/tests/generated/v3.0/allof-example.ts +++ b/tests/generated/v3.0/allof-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/anyof-example.ts b/tests/generated/v3.0/anyof-example.ts index 07857102..19515958 100644 --- a/tests/generated/v3.0/anyof-example.ts +++ b/tests/generated/v3.0/anyof-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/api-with-examples.ts b/tests/generated/v3.0/api-with-examples.ts index d1f2a06d..4340ee43 100644 --- a/tests/generated/v3.0/api-with-examples.ts +++ b/tests/generated/v3.0/api-with-examples.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/callback-example.ts b/tests/generated/v3.0/callback-example.ts index ca2667d3..640c75fd 100644 --- a/tests/generated/v3.0/callback-example.ts +++ b/tests/generated/v3.0/callback-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/components-responses.ts b/tests/generated/v3.0/components-responses.ts index e3263988..ac67b6d5 100644 --- a/tests/generated/v3.0/components-responses.ts +++ b/tests/generated/v3.0/components-responses.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/explode-param-3.0.1.ts b/tests/generated/v3.0/explode-param-3.0.1.ts index acd4b6a9..62db4cac 100644 --- a/tests/generated/v3.0/explode-param-3.0.1.ts +++ b/tests/generated/v3.0/explode-param-3.0.1.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/link-example.ts b/tests/generated/v3.0/link-example.ts index d39a8455..c9987ec7 100644 --- a/tests/generated/v3.0/link-example.ts +++ b/tests/generated/v3.0/link-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/no-definitions-schema.ts b/tests/generated/v3.0/no-definitions-schema.ts index e435e2ee..31ad9711 100644 --- a/tests/generated/v3.0/no-definitions-schema.ts +++ b/tests/generated/v3.0/no-definitions-schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/nullable-refs.ts b/tests/generated/v3.0/nullable-refs.ts index 6bd07cb4..b1b170c9 100644 --- a/tests/generated/v3.0/nullable-refs.ts +++ b/tests/generated/v3.0/nullable-refs.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/oneof-example.ts b/tests/generated/v3.0/oneof-example.ts index fe102ad2..de05928c 100644 --- a/tests/generated/v3.0/oneof-example.ts +++ b/tests/generated/v3.0/oneof-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/personal-api-example.ts b/tests/generated/v3.0/personal-api-example.ts index 16557ce0..18090a78 100644 --- a/tests/generated/v3.0/personal-api-example.ts +++ b/tests/generated/v3.0/personal-api-example.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/petstore-expanded.ts b/tests/generated/v3.0/petstore-expanded.ts index f160e4b5..b3f64d33 100644 --- a/tests/generated/v3.0/petstore-expanded.ts +++ b/tests/generated/v3.0/petstore-expanded.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/petstore.ts b/tests/generated/v3.0/petstore.ts index 41c55b67..18cbfcee 100644 --- a/tests/generated/v3.0/petstore.ts +++ b/tests/generated/v3.0/petstore.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/responses.ts b/tests/generated/v3.0/responses.ts index d78b4de7..284bc2bd 100644 --- a/tests/generated/v3.0/responses.ts +++ b/tests/generated/v3.0/responses.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/swaggerhub-template.ts b/tests/generated/v3.0/swaggerhub-template.ts index c172b7d9..1cb30a36 100644 --- a/tests/generated/v3.0/swaggerhub-template.ts +++ b/tests/generated/v3.0/swaggerhub-template.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts index ebd8ed2f..2cd6c53a 100644 --- a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts +++ b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/up-banking.ts b/tests/generated/v3.0/up-banking.ts index 62a8ddd4..cb0e86ea 100644 --- a/tests/generated/v3.0/up-banking.ts +++ b/tests/generated/v3.0/up-banking.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/uspto.ts b/tests/generated/v3.0/uspto.ts index 870a7509..24452617 100644 --- a/tests/generated/v3.0/uspto.ts +++ b/tests/generated/v3.0/uspto.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/generated/v3.0/wrong-enum-subtypes.ts b/tests/generated/v3.0/wrong-enum-subtypes.ts index 76ca5730..b30efae4 100644 --- a/tests/generated/v3.0/wrong-enum-subtypes.ts +++ b/tests/generated/v3.0/wrong-enum-subtypes.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/schemas/v2.0/another-schema.json b/tests/schemas/v2.0/another-schema.json new file mode 100644 index 00000000..0c01c418 --- /dev/null +++ b/tests/schemas/v2.0/another-schema.json @@ -0,0 +1,125 @@ +{ + "x-generator": "NSwag v11.14.0.0 (NJsonSchema v9.10.24.0 (Newtonsoft.Json v9.0.0.0))", + "swagger": "2.0", + "info": { + "title": "", + "version": "" + }, + "schemes": [], + "consumes": ["application/json"], + "produces": ["application/json"], + "paths": { + "/api/Foo/GetBarDescriptions": { + "get": { + "tags": ["Foo"], + "operationId": "Foo_GetBarDescriptions", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "x-nullable": true + } + } + } + }, + "/api/Foo/GetBar": { + "get": { + "tags": ["Foo"], + "operationId": "Foo_GetBar", + "parameters": [ + { + "type": "integer", + "name": "id", + "in": "query", + "required": true, + "x-nullable": false, + "format": "int32" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/Bar" + }, + "x-nullable": true + } + } + } + }, + "/api/Foo/SetBar": { + "post": { + "tags": ["Foo"], + "operationId": "Foo_SetBar", + "parameters": [ + { + "name": "value", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Bar" + }, + "x-nullable": true + } + ], + "responses": { + "204": { + "description": "" + } + } + } + } + }, + "definitions": { + "Bar": { + "type": "object", + "additionalProperties": false, + "required": ["B", "C"], + "properties": { + "A": { + "type": "string" + }, + "B": { + "type": "integer", + "format": "int32" + }, + "C": { + "type": "string", + "format": "date-time" + }, + "Baz": { + "$ref": "#/definitions/Baz" + } + } + }, + "Baz": { + "type": "object", + "additionalProperties": false, + "required": ["D", "Color"], + "properties": { + "D": { + "type": "number", + "format": "decimal" + }, + "Color": { + "$ref": "#/definitions/Color" + } + } + }, + "Color": { + "type": "integer", + "description": "", + "x-enumNames": ["RED", "GREEN", "BLUE"], + "enum": [0, 1, 2] + } + }, + "parameters": {}, + "responses": {}, + "securityDefinitions": {} +} diff --git a/tests/spec/defaultAsSuccess/schema.ts b/tests/spec/defaultAsSuccess/schema.ts index cd5b5708..6b213d02 100644 --- a/tests/spec/defaultAsSuccess/schema.ts +++ b/tests/spec/defaultAsSuccess/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/defaultResponse/schema.ts b/tests/spec/defaultResponse/schema.ts index 186205a2..0b8f331e 100644 --- a/tests/spec/defaultResponse/schema.ts +++ b/tests/spec/defaultResponse/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/enumNamesAsValues/schema.ts b/tests/spec/enumNamesAsValues/schema.ts index fe45ce21..a3e42ac0 100644 --- a/tests/spec/enumNamesAsValues/schema.ts +++ b/tests/spec/enumNamesAsValues/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/extractRequestParams/schema.ts b/tests/spec/extractRequestParams/schema.ts index dede2b9f..43112fe8 100644 --- a/tests/spec/extractRequestParams/schema.ts +++ b/tests/spec/extractRequestParams/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/js/schema.d.ts b/tests/spec/js/schema.d.ts index 4949ae90..aa09f7cb 100644 --- a/tests/spec/js/schema.d.ts +++ b/tests/spec/js/schema.d.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/js/schema.js b/tests/spec/js/schema.js index c417a33a..20e07178 100644 --- a/tests/spec/js/schema.js +++ b/tests/spec/js/schema.js @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/modular/Key.ts b/tests/spec/modular/Key.ts index 0eb28e19..215916ea 100644 --- a/tests/spec/modular/Key.ts +++ b/tests/spec/modular/Key.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/modular/Login.ts b/tests/spec/modular/Login.ts index 1ea40358..8a6aa3f3 100644 --- a/tests/spec/modular/Login.ts +++ b/tests/spec/modular/Login.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/modular/Scope.ts b/tests/spec/modular/Scope.ts index e3d09324..5beca63c 100644 --- a/tests/spec/modular/Scope.ts +++ b/tests/spec/modular/Scope.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/modular/data-contracts.ts b/tests/spec/modular/data-contracts.ts index d9a96467..ba9566e1 100644 --- a/tests/spec/modular/data-contracts.ts +++ b/tests/spec/modular/data-contracts.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/modular/http-client.ts b/tests/spec/modular/http-client.ts index a5480ae2..6498bc6c 100644 --- a/tests/spec/modular/http-client.ts +++ b/tests/spec/modular/http-client.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/moduleNameIndex/schema.ts b/tests/spec/moduleNameIndex/schema.ts index 18731449..ed15f0da 100644 --- a/tests/spec/moduleNameIndex/schema.ts +++ b/tests/spec/moduleNameIndex/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/noClient/schema.ts b/tests/spec/noClient/schema.ts index 6d226378..db2f2797 100644 --- a/tests/spec/noClient/schema.ts +++ b/tests/spec/noClient/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/responses/schema.ts b/tests/spec/responses/schema.ts index 37f25a9a..ce346223 100644 --- a/tests/spec/responses/schema.ts +++ b/tests/spec/responses/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/routeTypes/schema.ts b/tests/spec/routeTypes/schema.ts index ee6dac48..f4b80423 100644 --- a/tests/spec/routeTypes/schema.ts +++ b/tests/spec/routeTypes/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/singleHttpClient/schema.ts b/tests/spec/singleHttpClient/schema.ts index 06c2b2e5..3269b718 100644 --- a/tests/spec/singleHttpClient/schema.ts +++ b/tests/spec/singleHttpClient/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/specProperty/schema.ts b/tests/spec/specProperty/schema.ts index a151dedc..a78a4dd1 100644 --- a/tests/spec/specProperty/schema.ts +++ b/tests/spec/specProperty/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/templates/schema.ts b/tests/spec/templates/schema.ts index 2c3703b3..0d0a6374 100644 --- a/tests/spec/templates/schema.ts +++ b/tests/spec/templates/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## diff --git a/tests/spec/unionEnums/schema.ts b/tests/spec/unionEnums/schema.ts index 2b115981..5a6f5c41 100644 --- a/tests/spec/unionEnums/schema.ts +++ b/tests/spec/unionEnums/schema.ts @@ -1,5 +1,5 @@ -/* eslint:disable */ -/* tslint-disable */ +/* eslint-disable */ +/* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##