diff --git a/package.json b/package.json index 2274f9f1b..8c6682ab1 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@parsable/openapi-typescript-codegen", + "name": "@paxful/openapi-typescript-codegen", "version": "0.0.4", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", diff --git a/src/templates/exportAppClient.hbs b/src/templates/exportAppClient.hbs index a3b93070f..1e417a5f9 100644 --- a/src/templates/exportAppClient.hbs +++ b/src/templates/exportAppClient.hbs @@ -1,39 +1,39 @@ {{>header}} -import type { BaseHttpRequest } from './core'; -import { {{{httpClientRequest}}} } from './core'; -import type { ClientConfig } from './core'; +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { {{{httpClientRequest}}} } from './core/{{{httpClientRequest}}}'; {{#if services}} -import { {{#each services}} - {{{name}}}, +import { {{{name}}} } from './services/{{{name}}}'; {{/each}} -} from './services'; {{/if}} {{#if service}} -import { {{{service.name}}} } from './services'; +import { {{{service.name}}} } from './services/{{{service.name}}}'; {{/if}} export class {{{clientName}}} {{#if service}}extends {{{service.name}}} {{/if}}{ {{#each services}} readonly {{{shortName}}}: {{{name}}}; {{/each}} + readonly request: BaseHttpRequest; - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new {{{httpClientRequest}}}()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? '{{{server}}}', - version: clientConfig?.version ?? '{{{version}}}', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = {{{httpClientRequest}}}) { + {{#if service}}const request{{else}}this.request{{/if}} = new HttpRequest({ + BASE: openApiConfig?.BASE ?? '{{{server}}}', + VERSION: openApiConfig?.VERSION ?? '{{{version}}}', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); {{#if service}} - super(httpClient, config); + super(request); + this.request = request; {{/if}} {{#each services}} - this.{{{shortName}}} = new {{{name}}}(httpClient, config); + this.{{{shortName}}} = new {{{name}}}(this.request); {{/each}} } } diff --git a/test/__snapshots__/index.client.spec.js.snap b/test/__snapshots__/index.client.spec.js.snap index cfa4b28b8..c23be3a99 100644 --- a/test/__snapshots__/index.client.spec.js.snap +++ b/test/__snapshots__/index.client.spec.js.snap @@ -1,40 +1,38 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { - SimpleService, -} from './services'; -import { Service } from './services'; +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { SimpleService } from './services/SimpleService'; +import { Service } from './services/Service'; export class TestClient extends Service { readonly simple: SimpleService; - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - super(httpClient, config); - this.simple = new SimpleService(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + const request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + super(request); + this.request = request; + this.simple = new SimpleService(this.request); } }" `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -57,8 +55,7 @@ export class ApiError extends Error { `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -76,47 +73,48 @@ export type ApiRequestOptions = { `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -126,26 +124,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -174,9 +152,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -204,11 +182,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -255,13 +233,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -316,19 +294,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -348,8 +327,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -357,233 +335,118 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; - -export { TestClient } from './client'; -" -`; +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -" -`; +export { Service } from './services/Service'; +export { SimpleService } from './services/SimpleService'; -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ +export { TestClient } from './client'; " `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/services/Service.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ServiceFull } from './ServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class Service { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/services/ServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; + private httpRequest: BaseHttpRequest; -export class ServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/services/SimpleService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { SimpleServiceFull } from './SimpleServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class SimpleService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: SimpleServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new SimpleServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/services/SimpleServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; + private httpRequest: BaseHttpRequest; -export class SimpleServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; -exports[`v2 should generate with combined tags: ./test/generated/v2_client_tags_combined/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { Service } from './Service'; -export { ServiceFull } from './ServiceFull'; -export { SimpleService } from './SimpleService'; -export { SimpleServiceFull } from './SimpleServiceFull'; -" -`; - exports[`v2 should generate with exportClient: ./test/generated/v2_client/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { - CollectionFormatService, - ComplexService, - DefaultsService, - DuplicateService, - HeaderService, - NoContentService, - ParametersService, - ResponseService, - SimpleService, - TypesService, -} from './services'; +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { CollectionFormatService } from './services/CollectionFormatService'; +import { ComplexService } from './services/ComplexService'; +import { DefaultsService } from './services/DefaultsService'; +import { DuplicateService } from './services/DuplicateService'; +import { HeaderService } from './services/HeaderService'; +import { NoContentService } from './services/NoContentService'; +import { ParametersService } from './services/ParametersService'; +import { ResponseService } from './services/ResponseService'; +import { SimpleService } from './services/SimpleService'; +import { TypesService } from './services/TypesService'; export class TestClient { readonly collectionformat: CollectionFormatService; @@ -596,34 +459,34 @@ export class TestClient { readonly response: ResponseService; readonly simple: SimpleService; readonly types: TypesService; - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - this.collectionformat = new CollectionFormatService(httpClient, config); - this.complex = new ComplexService(httpClient, config); - this.defaults = new DefaultsService(httpClient, config); - this.duplicate = new DuplicateService(httpClient, config); - this.header = new HeaderService(httpClient, config); - this.nocontent = new NoContentService(httpClient, config); - this.parameters = new ParametersService(httpClient, config); - this.response = new ResponseService(httpClient, config); - this.simple = new SimpleService(httpClient, config); - this.types = new TypesService(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + this.request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + this.collectionformat = new CollectionFormatService(this.request); + this.complex = new ComplexService(this.request); + this.defaults = new DefaultsService(this.request); + this.duplicate = new DuplicateService(this.request); + this.header = new HeaderService(this.request); + this.nocontent = new NoContentService(this.request); + this.parameters = new ParametersService(this.request); + this.response = new ResponseService(this.request); + this.simple = new SimpleService(this.request); + this.types = new TypesService(this.request); } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -646,8 +509,7 @@ export class ApiError extends Error { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -665,47 +527,48 @@ export type ApiRequestOptions = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -715,26 +578,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -763,9 +606,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -793,11 +636,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -844,13 +687,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -905,19 +748,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -937,8 +781,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -946,49 +789,132 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v2 should generate with exportClient: ./test/generated/v2_client/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; + +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { Date } from './models/Date'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export { EnumFromDescription } from './models/EnumFromDescription'; +export { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithStrings } from './models/EnumWithStrings'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum } from './models/ModelWithEnum'; +export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableString } from './models/ModelWithNullableString'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { MultilineComment } from './models/MultilineComment'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $Date } from './schemas/$Date'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $MultilineComment } from './schemas/$MultilineComment'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultsService } from './services/DefaultsService'; +export { DuplicateService } from './services/DuplicateService'; +export { HeaderService } from './services/HeaderService'; +export { NoContentService } from './services/NoContentService'; +export { ParametersService } from './services/ParametersService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; export { TestClient } from './client'; " `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1001,8 +927,7 @@ export type ArrayWithArray = Array>;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithBooleans.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1013,8 +938,7 @@ export type ArrayWithBooleans = Array;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1025,8 +949,7 @@ export type ArrayWithNumbers = Array;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1040,8 +963,7 @@ export type ArrayWithProperties = Array<{ `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithReferences.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1054,8 +976,7 @@ export type ArrayWithReferences = Array;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ArrayWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1066,8 +987,7 @@ export type ArrayWithStrings = Array;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/Date.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1078,8 +998,7 @@ export type Date = string;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/DictionaryWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1092,8 +1011,7 @@ export type DictionaryWithArray = Record>;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/DictionaryWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1104,8 +1022,7 @@ export type DictionaryWithDictionary = Record>;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/DictionaryWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1119,8 +1036,7 @@ export type DictionaryWithProperties = Record;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/DictionaryWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1145,8 +1060,7 @@ export type DictionaryWithString = Record;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/EnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1161,8 +1075,7 @@ export enum EnumFromDescription { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/EnumWithExtensions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1186,8 +1099,7 @@ export enum EnumWithExtensions { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/EnumWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1214,8 +1126,7 @@ export enum EnumWithNumbers { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/EnumWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1230,8 +1141,7 @@ export enum EnumWithStrings { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelThatExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1248,8 +1158,7 @@ export type ModelThatExtends = (ModelWithString & { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelThatExtendsExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1267,8 +1176,7 @@ export type ModelThatExtendsExtends = (ModelWithString & ModelThatExtends & { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1286,8 +1194,7 @@ export type ModelWithArray = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1304,8 +1211,7 @@ export type ModelWithBoolean = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithCircularReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1319,8 +1225,7 @@ export type ModelWithCircularReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1334,8 +1239,7 @@ export type ModelWithDictionary = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithDuplicateImports.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1353,8 +1257,7 @@ export type ModelWithDuplicateImports = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithDuplicateProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1370,8 +1273,7 @@ export type ModelWithDuplicateProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithEnum.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1422,8 +1324,7 @@ export namespace ModelWithEnum { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithEnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1454,8 +1355,7 @@ export namespace ModelWithEnumFromDescription { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1472,8 +1372,7 @@ export type ModelWithInteger = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithNestedEnums.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1490,8 +1389,7 @@ export type ModelWithNestedEnums = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithNestedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1509,8 +1407,7 @@ export type ModelWithNestedProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithNullableString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1531,8 +1428,7 @@ export type ModelWithNullableString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithOrderedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1548,8 +1444,7 @@ export type ModelWithOrderedProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1568,8 +1463,7 @@ export type ModelWithPattern = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1595,8 +1489,7 @@ export type ModelWithProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1612,8 +1505,7 @@ export type ModelWithReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/ModelWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1630,8 +1522,7 @@ export type ModelWithString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/MultilineComment.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1645,8 +1536,7 @@ export type MultilineComment = number;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1657,8 +1547,7 @@ export type SimpleBoolean = boolean;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleFile.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1669,8 +1558,7 @@ export type SimpleFile = Blob;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1681,8 +1569,7 @@ export type SimpleInteger = number;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1695,8 +1582,7 @@ export type SimpleReference = ModelWithString;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1707,8 +1593,7 @@ export type SimpleString = string;" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/SimpleStringWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -1718,59 +1603,8 @@ exports[`v2 should generate with exportClient: ./test/generated/v2_client/models export type SimpleStringWithPattern = string;" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export type { ArrayWithArray } from './ArrayWithArray'; -export type { ArrayWithBooleans } from './ArrayWithBooleans'; -export type { ArrayWithNumbers } from './ArrayWithNumbers'; -export type { ArrayWithProperties } from './ArrayWithProperties'; -export type { ArrayWithReferences } from './ArrayWithReferences'; -export type { ArrayWithStrings } from './ArrayWithStrings'; -export type { Date } from './Date'; -export type { DictionaryWithArray } from './DictionaryWithArray'; -export type { DictionaryWithDictionary } from './DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './DictionaryWithProperties'; -export type { DictionaryWithReference } from './DictionaryWithReference'; -export type { DictionaryWithString } from './DictionaryWithString'; -export { EnumFromDescription } from './EnumFromDescription'; -export { EnumWithExtensions } from './EnumWithExtensions'; -export { EnumWithNumbers } from './EnumWithNumbers'; -export { EnumWithStrings } from './EnumWithStrings'; -export type { ModelThatExtends } from './ModelThatExtends'; -export type { ModelThatExtendsExtends } from './ModelThatExtendsExtends'; -export type { ModelWithArray } from './ModelWithArray'; -export type { ModelWithBoolean } from './ModelWithBoolean'; -export type { ModelWithCircularReference } from './ModelWithCircularReference'; -export type { ModelWithDictionary } from './ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './ModelWithDuplicateProperties'; -export type { ModelWithEnum } from './ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './ModelWithEnumFromDescription'; -export type { ModelWithInteger } from './ModelWithInteger'; -export type { ModelWithNestedEnums } from './ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './ModelWithNestedProperties'; -export type { ModelWithNullableString } from './ModelWithNullableString'; -export type { ModelWithOrderedProperties } from './ModelWithOrderedProperties'; -export type { ModelWithPattern } from './ModelWithPattern'; -export type { ModelWithProperties } from './ModelWithProperties'; -export type { ModelWithReference } from './ModelWithReference'; -export type { ModelWithString } from './ModelWithString'; -export type { MultilineComment } from './MultilineComment'; -export type { SimpleBoolean } from './SimpleBoolean'; -export type { SimpleFile } from './SimpleFile'; -export type { SimpleInteger } from './SimpleInteger'; -export type { SimpleReference } from './SimpleReference'; -export type { SimpleString } from './SimpleString'; -export type { SimpleStringWithPattern } from './SimpleStringWithPattern'; -" -`; - exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithArray = { @@ -1785,8 +1619,7 @@ export const $ArrayWithArray = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithBooleans.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithBooleans = { @@ -1798,8 +1631,7 @@ export const $ArrayWithBooleans = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithNumbers = { @@ -1811,8 +1643,7 @@ export const $ArrayWithNumbers = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithProperties = { @@ -1831,8 +1662,7 @@ export const $ArrayWithProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithReferences.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithReferences = { @@ -1844,8 +1674,7 @@ export const $ArrayWithReferences = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ArrayWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithStrings = { @@ -1857,8 +1686,7 @@ export const $ArrayWithStrings = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$Date.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $Date = { @@ -1867,8 +1695,7 @@ export const $Date = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$DictionaryWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithArray = { @@ -1883,8 +1710,7 @@ export const $DictionaryWithArray = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$DictionaryWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithDictionary = { @@ -1899,8 +1725,7 @@ export const $DictionaryWithDictionary = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$DictionaryWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithProperties = { @@ -1919,8 +1744,7 @@ export const $DictionaryWithProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$DictionaryWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithReference = { @@ -1932,8 +1756,7 @@ export const $DictionaryWithReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$DictionaryWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithString = { @@ -1945,8 +1768,7 @@ export const $DictionaryWithString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$EnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumFromDescription = { @@ -1955,8 +1777,7 @@ export const $EnumFromDescription = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$EnumWithExtensions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithExtensions = { @@ -1965,8 +1786,7 @@ export const $EnumWithExtensions = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$EnumWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithNumbers = { @@ -1975,8 +1795,7 @@ export const $EnumWithNumbers = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$EnumWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithStrings = { @@ -1985,8 +1804,7 @@ export const $EnumWithStrings = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelThatExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelThatExtends = { @@ -2007,8 +1825,7 @@ export const $ModelThatExtends = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelThatExtendsExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelThatExtendsExtends = { @@ -2031,8 +1848,7 @@ export const $ModelThatExtendsExtends = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithArray = { @@ -2060,8 +1876,7 @@ export const $ModelWithArray = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithBoolean = { @@ -2074,8 +1889,7 @@ export const $ModelWithBoolean = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithCircularReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithCircularReference = { @@ -2088,8 +1902,7 @@ export const $ModelWithCircularReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDictionary = { @@ -2105,8 +1918,7 @@ export const $ModelWithDictionary = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithDuplicateImports.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDuplicateImports = { @@ -2125,8 +1937,7 @@ export const $ModelWithDuplicateImports = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithDuplicateProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDuplicateProperties = { @@ -2139,8 +1950,7 @@ export const $ModelWithDuplicateProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithEnum.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithEnum = { @@ -2159,8 +1969,7 @@ export const $ModelWithEnum = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithEnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithEnumFromDescription = { @@ -2173,8 +1982,7 @@ export const $ModelWithEnumFromDescription = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithInteger = { @@ -2187,8 +1995,7 @@ export const $ModelWithInteger = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithNestedEnums.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithNestedEnums = { @@ -2222,8 +2029,7 @@ export const $ModelWithNestedEnums = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithNestedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithNestedProperties = { @@ -2250,8 +2056,7 @@ export const $ModelWithNestedProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithNullableString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithNullableString = { @@ -2270,8 +2075,7 @@ export const $ModelWithNullableString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithOrderedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithOrderedProperties = { @@ -2290,8 +2094,7 @@ export const $ModelWithOrderedProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithPattern = { @@ -2329,8 +2132,7 @@ export const $ModelWithPattern = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithProperties = { @@ -2378,8 +2180,7 @@ export const $ModelWithProperties = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithReference = { @@ -2392,8 +2193,7 @@ export const $ModelWithReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$ModelWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithString = { @@ -2406,8 +2206,7 @@ export const $ModelWithString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$MultilineComment.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $MultilineComment = { @@ -2416,8 +2215,7 @@ export const $MultilineComment = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleBoolean = { @@ -2426,8 +2224,7 @@ export const $SimpleBoolean = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleFile.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleFile = { @@ -2436,8 +2233,7 @@ export const $SimpleFile = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleInteger = { @@ -2446,8 +2242,7 @@ export const $SimpleInteger = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleReference = { @@ -2456,8 +2251,7 @@ export const $SimpleReference = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleString = { @@ -2466,8 +2260,7 @@ export const $SimpleString = { `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/$SimpleStringWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleStringWithPattern = { @@ -2477,73 +2270,17 @@ export const $SimpleStringWithPattern = { };" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { $ArrayWithArray } from './$ArrayWithArray'; -export { $ArrayWithBooleans } from './$ArrayWithBooleans'; -export { $ArrayWithNumbers } from './$ArrayWithNumbers'; -export { $ArrayWithProperties } from './$ArrayWithProperties'; -export { $ArrayWithReferences } from './$ArrayWithReferences'; -export { $ArrayWithStrings } from './$ArrayWithStrings'; -export { $Date } from './$Date'; -export { $DictionaryWithArray } from './$DictionaryWithArray'; -export { $DictionaryWithDictionary } from './$DictionaryWithDictionary'; -export { $DictionaryWithProperties } from './$DictionaryWithProperties'; -export { $DictionaryWithReference } from './$DictionaryWithReference'; -export { $DictionaryWithString } from './$DictionaryWithString'; -export { $EnumFromDescription } from './$EnumFromDescription'; -export { $EnumWithExtensions } from './$EnumWithExtensions'; -export { $EnumWithNumbers } from './$EnumWithNumbers'; -export { $EnumWithStrings } from './$EnumWithStrings'; -export { $ModelThatExtends } from './$ModelThatExtends'; -export { $ModelThatExtendsExtends } from './$ModelThatExtendsExtends'; -export { $ModelWithArray } from './$ModelWithArray'; -export { $ModelWithBoolean } from './$ModelWithBoolean'; -export { $ModelWithCircularReference } from './$ModelWithCircularReference'; -export { $ModelWithDictionary } from './$ModelWithDictionary'; -export { $ModelWithDuplicateImports } from './$ModelWithDuplicateImports'; -export { $ModelWithDuplicateProperties } from './$ModelWithDuplicateProperties'; -export { $ModelWithEnum } from './$ModelWithEnum'; -export { $ModelWithEnumFromDescription } from './$ModelWithEnumFromDescription'; -export { $ModelWithInteger } from './$ModelWithInteger'; -export { $ModelWithNestedEnums } from './$ModelWithNestedEnums'; -export { $ModelWithNestedProperties } from './$ModelWithNestedProperties'; -export { $ModelWithNullableString } from './$ModelWithNullableString'; -export { $ModelWithOrderedProperties } from './$ModelWithOrderedProperties'; -export { $ModelWithPattern } from './$ModelWithPattern'; -export { $ModelWithProperties } from './$ModelWithProperties'; -export { $ModelWithReference } from './$ModelWithReference'; -export { $ModelWithString } from './$ModelWithString'; -export { $MultilineComment } from './$MultilineComment'; -export { $SimpleBoolean } from './$SimpleBoolean'; -export { $SimpleFile } from './$SimpleFile'; -export { $SimpleInteger } from './$SimpleInteger'; -export { $SimpleReference } from './$SimpleReference'; -export { $SimpleString } from './$SimpleString'; -export { $SimpleStringWithPattern } from './$SimpleStringWithPattern'; -" -`; - exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/CollectionFormatService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { CollectionFormatServiceFull } from './CollectionFormatServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class CollectionFormatService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: CollectionFormatServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new CollectionFormatServiceFull(httpRequest, clientConfig); } /** @@ -2552,7 +2289,6 @@ export class CollectionFormatService { * @param parameterArrayTsv This is an array parameter that is send as tsv format (tab-separated values) * @param parameterArrayPipes This is an array parameter that is send as pipes format (pipe-separated values) * @param parameterArrayMulti This is an array parameter that is send as multi format (multiple parameter instances) - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async collectionFormat( @@ -2561,52 +2297,10 @@ export class CollectionFormatService { parameterArrayTsv: Array, parameterArrayPipes: Array, parameterArrayMulti: Array, - config?: ClientConfig ): Promise { - return (await this.full.collectionFormat( - parameterArrayCsv, parameterArraySsv, parameterArrayTsv, parameterArrayPipes, parameterArrayMulti, config - )).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/CollectionFormatServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class CollectionFormatServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterArrayCsv This is an array parameter that is send as csv format (comma-separated values) - * @param parameterArraySsv This is an array parameter that is send as ssv format (space-separated values) - * @param parameterArrayTsv This is an array parameter that is send as tsv format (tab-separated values) - * @param parameterArrayPipes This is an array parameter that is send as pipes format (pipe-separated values) - * @param parameterArrayMulti This is an array parameter that is send as multi format (multiple parameter instances) - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async collectionFormat( - parameterArrayCsv: Array, - parameterArraySsv: Array, - parameterArrayTsv: Array, - parameterArrayPipes: Array, - parameterArrayMulti: Array, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/collectionFormat\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/collectionFormat\`, query: { 'parameterArrayCSV': parameterArrayCsv, 'parameterArraySSV': parameterArraySsv, @@ -2614,38 +2308,30 @@ export class CollectionFormatServiceFull { 'parameterArrayPipes': parameterArrayPipes, 'parameterArrayMulti': parameterArrayMulti, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ComplexService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ComplexServiceFull } from './ComplexServiceFull'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class ComplexService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ComplexServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ComplexServiceFull(httpRequest, clientConfig); } /** * @param parameterObject Parameter containing object * @param parameterReference Parameter containing reference - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Successful response * @throws ApiError */ @@ -2658,56 +2344,10 @@ export class ComplexService { }, }, parameterReference: ModelWithString, - config?: ClientConfig ): Promise> { - return (await this.full.complexTypes( - parameterObject, parameterReference, config - )).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ComplexServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ComplexServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterObject Parameter containing object - * @param parameterReference Parameter containing reference - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Successful response - * @throws ApiError - */ - public async complexTypes( - parameterObject: { - first?: { - second?: { - third?: string, - }, - }, - }, - parameterReference: ModelWithString, - config?: ClientConfig - ): Promise>> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/complex\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/complex\`, query: { 'parameterObject': parameterObject, 'parameterReference': parameterReference, @@ -2716,32 +2356,25 @@ export class ComplexServiceFull { 400: \`400 server error\`, 500: \`500 server error\`, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/DefaultsService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { DefaultsServiceFull } from './DefaultsServiceFull'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class DefaultsService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: DefaultsServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new DefaultsServiceFull(httpRequest, clientConfig); } /** @@ -2750,7 +2383,6 @@ export class DefaultsService { * @param parameterBoolean This is a simple boolean with default value * @param parameterEnum This is a simple enum with default value * @param parameterModel This is a simple model with default value - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithDefaultParameters( @@ -2761,105 +2393,10 @@ export class DefaultsService { parameterModel: ModelWithString = { \\"prop\\": \\"Hello World!\\" }, - config?: ClientConfig - ): Promise { - return (await this.full.callWithDefaultParameters( - parameterString, parameterNumber, parameterBoolean, parameterEnum, parameterModel, config - )).body; - } - - /** - * @param parameterString This is a simple string that is optional with default value - * @param parameterNumber This is a simple number that is optional with default value - * @param parameterBoolean This is a simple boolean that is optional with default value - * @param parameterEnum This is a simple enum that is optional with default value - * @param parameterModel This is a simple model that is optional with default value - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithDefaultOptionalParameters( - parameterString: string = 'Hello World!', - parameterNumber: number = 123, - parameterBoolean: boolean = true, - parameterEnum: 'Success' | 'Warning' | 'Error' = 'Success', - parameterModel: ModelWithString = { - \\"prop\\": \\"Hello World!\\" - }, - config?: ClientConfig - ): Promise { - return (await this.full.callWithDefaultOptionalParameters( - parameterString, parameterNumber, parameterBoolean, parameterEnum, parameterModel, config - )).body; - } - - /** - * @param parameterStringWithNoDefault This is a string with no default - * @param parameterOptionalStringWithDefault This is a optional string with default - * @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default - * @param parameterOptionalStringWithNoDefault This is a optional string with no default - * @param parameterStringWithDefault This is a string with default - * @param parameterStringWithEmptyDefault This is a string with empty default - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callToTestOrderOfParams( - parameterStringWithNoDefault: string, - parameterOptionalStringWithDefault: string = 'Hello World!', - parameterOptionalStringWithEmptyDefault: string = '', - parameterOptionalStringWithNoDefault?: string, - parameterStringWithDefault: string = 'Hello World!', - parameterStringWithEmptyDefault: string = '', - config?: ClientConfig ): Promise { - return (await this.full.callToTestOrderOfParams( - parameterStringWithNoDefault, parameterOptionalStringWithDefault, parameterOptionalStringWithEmptyDefault, parameterOptionalStringWithNoDefault, parameterStringWithDefault, parameterStringWithEmptyDefault, config - )).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/DefaultsServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class DefaultsServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterString This is a simple string with default value - * @param parameterNumber This is a simple number with default value - * @param parameterBoolean This is a simple boolean with default value - * @param parameterEnum This is a simple enum with default value - * @param parameterModel This is a simple model with default value - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithDefaultParameters( - parameterString: string = 'Hello World!', - parameterNumber: number = 123, - parameterBoolean: boolean = true, - parameterEnum: 'Success' | 'Warning' | 'Error' = 'Success', - parameterModel: ModelWithString = { - \\"prop\\": \\"Hello World!\\" - }, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterString': parameterString, 'parameterNumber': parameterNumber, @@ -2867,7 +2404,8 @@ export class DefaultsServiceFull { 'parameterEnum': parameterEnum, 'parameterModel': parameterModel, }, - }, this.clientConfig, config); + }); + return result.body; } /** @@ -2876,7 +2414,6 @@ export class DefaultsServiceFull { * @param parameterBoolean This is a simple boolean that is optional with default value * @param parameterEnum This is a simple enum that is optional with default value * @param parameterModel This is a simple model that is optional with default value - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithDefaultOptionalParameters( @@ -2887,11 +2424,10 @@ export class DefaultsServiceFull { parameterModel: ModelWithString = { \\"prop\\": \\"Hello World!\\" }, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterString': parameterString, 'parameterNumber': parameterNumber, @@ -2899,7 +2435,8 @@ export class DefaultsServiceFull { 'parameterEnum': parameterEnum, 'parameterModel': parameterModel, }, - }, this.clientConfig, config); + }); + return result.body; } /** @@ -2909,7 +2446,6 @@ export class DefaultsServiceFull { * @param parameterOptionalStringWithNoDefault This is a optional string with no default * @param parameterStringWithDefault This is a string with default * @param parameterStringWithEmptyDefault This is a string with empty default - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callToTestOrderOfParams( @@ -2919,11 +2455,10 @@ export class DefaultsServiceFull { parameterOptionalStringWithNoDefault?: string, parameterStringWithDefault: string = 'Hello World!', parameterStringWithEmptyDefault: string = '', - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterStringWithNoDefault': parameterStringWithNoDefault, 'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault, @@ -2932,275 +2467,145 @@ export class DefaultsServiceFull { 'parameterStringWithDefault': parameterStringWithDefault, 'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/DuplicateService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { DuplicateServiceFull } from './DuplicateServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class DuplicateService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: DuplicateServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new DuplicateServiceFull(httpRequest, clientConfig); } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName(config?: ClientConfig): Promise { - return (await this.full.duplicateName(config)).body; + public async duplicateName(): Promise { + const result = await this.httpRequest.request({ + method: 'GET', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName1(config?: ClientConfig): Promise { - return (await this.full.duplicateName1(config)).body; + public async duplicateName1(): Promise { + const result = await this.httpRequest.request({ + method: 'POST', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName2(config?: ClientConfig): Promise { - return (await this.full.duplicateName2(config)).body; + public async duplicateName2(): Promise { + const result = await this.httpRequest.request({ + method: 'PUT', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName3(config?: ClientConfig): Promise { - return (await this.full.duplicateName3(config)).body; + public async duplicateName3(): Promise { + const result = await this.httpRequest.request({ + method: 'DELETE', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } }" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/DuplicateServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/HeaderService.ts 1`] = ` +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; -export class DuplicateServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; +export class HeaderService { + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'GET', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); - } - - /** - * @param [config] the optional OpenAPI config to use + * @returns string Successful response * @throws ApiError */ - public async duplicateName1(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithResultFromHeader(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName2(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName3(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'DELETE', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/header\`, + responseHeader: 'operation-location', + errors: { + 400: \`400 server error\`, + 500: \`500 server error\`, + }, + }); + return result.body; } }" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/HeaderService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/NoContentService.ts 1`] = ` +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { HeaderServiceFull } from './HeaderServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; -export class HeaderService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: HeaderServiceFull; +export class NoContentService { + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new HeaderServiceFull(httpRequest, clientConfig); } /** - * @param [config] the optional OpenAPI config to use - * @returns string Successful response + * @returns void * @throws ApiError */ - public async callWithResultFromHeader(config?: ClientConfig): Promise { - return (await this.full.callWithResultFromHeader(config)).body; + public async callWithNoContentResponse(): Promise { + const result = await this.httpRequest.request({ + method: 'GET', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/no-content\`, + }); + return result.body; } }" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/HeaderServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ParametersService.ts 1`] = ` +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class HeaderServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns string Successful response - * @throws ApiError - */ - public async callWithResultFromHeader(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'POST', - path: \`/api/v\${this.clientConfig.version}/header\`, - responseHeader: 'operation-location', - errors: { - 400: \`400 server error\`, - 500: \`500 server error\`, - }, - }, this.clientConfig, config); - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/NoContentService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { NoContentServiceFull } from './NoContentServiceFull'; - -export class NoContentService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: NoContentServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new NoContentServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns void - * @throws ApiError - */ - public async callWithNoContentResponse(config?: ClientConfig): Promise { - return (await this.full.callWithNoContentResponse(config)).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/NoContentServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class NoContentServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns void - * @throws ApiError - */ - public async callWithNoContentResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'GET', - path: \`/api/v\${this.clientConfig.version}/no-content\`, - }, this.clientConfig, config); - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ParametersService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ParametersServiceFull } from './ParametersServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class ParametersService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ParametersServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ParametersServiceFull(httpRequest, clientConfig); } /** @@ -3209,7 +2614,6 @@ export class ParametersService { * @param parameterForm This is the parameter that goes into the form data * @param parameterBody This is the parameter that is send as request body * @param parameterPath This is the parameter that goes into the path - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithParameters( @@ -3218,80 +2622,10 @@ export class ParametersService { parameterForm: string, parameterBody: string, parameterPath: string, - config?: ClientConfig - ): Promise { - return (await this.full.callWithParameters( - parameterHeader, parameterQuery, parameterForm, parameterBody, parameterPath, config - )).body; - } - - /** - * @param parameterHeader This is the parameter that goes into the request header - * @param parameterQuery This is the parameter that goes into the request query params - * @param parameterForm This is the parameter that goes into the request form data - * @param parameterBody This is the parameter that is send as request body - * @param parameterPath1 This is the parameter that goes into the path - * @param parameterPath2 This is the parameter that goes into the path - * @param parameterPath3 This is the parameter that goes into the path - * @param _default This is the parameter with a reserved keyword - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithWeirdParameterNames( - parameterHeader: string, - parameterQuery: string, - parameterForm: string, - parameterBody: string, - parameterPath1?: string, - parameterPath2?: string, - parameterPath3?: string, - _default?: string, - config?: ClientConfig ): Promise { - return (await this.full.callWithWeirdParameterNames( - parameterHeader, parameterQuery, parameterForm, parameterBody, parameterPath1, parameterPath2, parameterPath3, _default, config - )).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ParametersServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ParametersServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterHeader This is the parameter that goes into the header - * @param parameterQuery This is the parameter that goes into the query params - * @param parameterForm This is the parameter that goes into the form data - * @param parameterBody This is the parameter that is send as request body - * @param parameterPath This is the parameter that goes into the path - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithParameters( - parameterHeader: string, - parameterQuery: string, - parameterForm: string, - parameterBody: string, - parameterPath: string, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/parameters/\${parameterPath}\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\${parameterPath}\`, headers: { 'parameterHeader': parameterHeader, }, @@ -3302,7 +2636,8 @@ export class ParametersServiceFull { 'parameterForm': parameterForm, }, body: parameterBody, - }, this.clientConfig, config); + }); + return result.body; } /** @@ -3314,7 +2649,6 @@ export class ParametersServiceFull { * @param parameterPath2 This is the parameter that goes into the path * @param parameterPath3 This is the parameter that goes into the path * @param _default This is the parameter with a reserved keyword - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithWeirdParameterNames( @@ -3326,11 +2660,10 @@ export class ParametersServiceFull { parameterPath2?: string, parameterPath3?: string, _default?: string, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/parameters/\${parameterPath1}/\${parameterPath2}/\${parameterPath3}\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\${parameterPath1}/\${parameterPath2}/\${parameterPath3}\`, headers: { 'parameter.header': parameterHeader, }, @@ -3342,341 +2675,189 @@ export class ParametersServiceFull { 'parameter_form': parameterForm, }, body: parameterBody, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ResponseService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelThatExtends, - ModelThatExtendsExtends, - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ResponseServiceFull } from './ResponseServiceFull'; +import type { ModelThatExtends } from '../models/ModelThatExtends'; +import type { ModelThatExtendsExtends } from '../models/ModelThatExtendsExtends'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class ResponseService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ResponseServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ResponseServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public async callWithResponse(config?: ClientConfig): Promise { - return (await this.full.callWithResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public async callWithDuplicateResponses(config?: ClientConfig): Promise { - return (await this.full.callWithDuplicateResponses(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public async callWithResponses(config?: ClientConfig): Promise<{ - readonly '@namespace.string'?: string, - readonly '@namespace.integer'?: number, - readonly value?: Array, - } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends> { - return (await this.full.callWithResponses(config)).body; - } + private httpRequest: BaseHttpRequest; -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/ResponseServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelThatExtends, - ModelThatExtendsExtends, - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ResponseServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Message for default response * @throws ApiError */ - public async callWithResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/response\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Message for default response * @throws ApiError */ - public async callWithDuplicateResponses(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithDuplicateResponses(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/response\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, errors: { 500: \`Message for 500 error\`, 501: \`Message for 501 error\`, 502: \`Message for 502 error\`, }, - }, this.clientConfig, config); + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @returns any Message for 200 response * @returns ModelWithString Message for default response * @returns ModelThatExtends Message for 201 response * @returns ModelThatExtendsExtends Message for 202 response * @throws ApiError */ - public async callWithResponses(config?: ClientConfig): Promise, - } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends>> { - return this.httpRequest.request({ + } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends> { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/response\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, errors: { 500: \`Message for 500 error\`, 501: \`Message for 501 error\`, 502: \`Message for 502 error\`, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/SimpleService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { SimpleServiceFull } from './SimpleServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class SimpleService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: SimpleServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new SimpleServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async deleteCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.deleteCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async optionsCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.optionsCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async headCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.headCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async patchCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.patchCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/SimpleServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; + private httpRequest: BaseHttpRequest; -export class SimpleServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async deleteCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async deleteCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'DELETE', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async optionsCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async optionsCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'OPTIONS', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async headCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async headCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'HEAD', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async patchCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async patchCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PATCH', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/TypesService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { TypesServiceFull } from './TypesServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class TypesService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: TypesServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new TypesServiceFull(httpRequest, clientConfig); } /** @@ -3688,7 +2869,6 @@ export class TypesService { * @param parameterBoolean This is a boolean parameter * @param parameterObject This is an object parameter * @param id This is a number parameter - * @param [config] the optional OpenAPI config to use * @returns number Response is a simple number * @returns string Response is a simple string * @returns boolean Response is a simple boolean @@ -3704,62 +2884,10 @@ export class TypesService { parameterBoolean: boolean = true, parameterObject: any = null, id?: number, - config?: ClientConfig ): Promise { - return (await this.full.types( - parameterArray, parameterDictionary, parameterEnum, parameterNumber, parameterString, parameterBoolean, parameterObject, id, config - )).body; - } - -}" -`; - -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/TypesServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class TypesServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterArray This is an array parameter - * @param parameterDictionary This is a dictionary parameter - * @param parameterEnum This is an enum parameter - * @param parameterNumber This is a number parameter - * @param parameterString This is a string parameter - * @param parameterBoolean This is a boolean parameter - * @param parameterObject This is an object parameter - * @param id This is a number parameter - * @param [config] the optional OpenAPI config to use - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns any Response is a simple object - * @throws ApiError - */ - public async types( - parameterArray: Array, - parameterDictionary: Record, - parameterEnum: 'Success' | 'Warning' | 'Error', - parameterNumber: number = 123, - parameterString: string = 'default', - parameterBoolean: boolean = true, - parameterObject: any = null, - id?: number, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/types\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/types\`, query: { 'parameterArray': parameterArray, 'parameterDictionary': parameterDictionary, @@ -3769,70 +2897,43 @@ export class TypesServiceFull { 'parameterBoolean': parameterBoolean, 'parameterObject': parameterObject, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; -exports[`v2 should generate with exportClient: ./test/generated/v2_client/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { CollectionFormatService } from './CollectionFormatService'; -export { CollectionFormatServiceFull } from './CollectionFormatServiceFull'; -export { ComplexService } from './ComplexService'; -export { ComplexServiceFull } from './ComplexServiceFull'; -export { DefaultsService } from './DefaultsService'; -export { DefaultsServiceFull } from './DefaultsServiceFull'; -export { DuplicateService } from './DuplicateService'; -export { DuplicateServiceFull } from './DuplicateServiceFull'; -export { HeaderService } from './HeaderService'; -export { HeaderServiceFull } from './HeaderServiceFull'; -export { NoContentService } from './NoContentService'; -export { NoContentServiceFull } from './NoContentServiceFull'; -export { ParametersService } from './ParametersService'; -export { ParametersServiceFull } from './ParametersServiceFull'; -export { ResponseService } from './ResponseService'; -export { ResponseServiceFull } from './ResponseServiceFull'; -export { SimpleService } from './SimpleService'; -export { SimpleServiceFull } from './SimpleServiceFull'; -export { TypesService } from './TypesService'; -export { TypesServiceFull } from './TypesServiceFull'; -" -`; - exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { Service } from './services'; +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { Service } from './services/Service'; export class TestClient extends Service { - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - super(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + const request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + super(request); + this.request = request; } }" `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -3855,8 +2956,7 @@ export class ApiError extends Error { `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -3874,47 +2974,48 @@ export type ApiRequestOptions = { `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -3924,26 +3025,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -3972,9 +3053,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -4002,11 +3083,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -4053,13 +3134,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -4114,19 +3195,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -4146,8 +3228,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -4155,205 +3236,117 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; + +export { Service } from './services/Service'; export { TestClient } from './client'; " `; -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/services/Service.ts 1`] = ` +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -" -`; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -" -`; +export class Service { + private httpRequest: BaseHttpRequest; -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/services/Service.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ServiceFull } from './ServiceFull'; - -export class Service { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ServiceFull(httpRequest, clientConfig); } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/services/ServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; -exports[`v2 should generate with no tags: ./test/generated/v2_client_no_tags/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { Service } from './Service'; -export { ServiceFull } from './ServiceFull'; -" -`; - exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { - SimpleService, -} from './services'; -import { Service } from './services'; +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { SimpleService } from './services/SimpleService'; +import { Service } from './services/Service'; export class TestClient extends Service { readonly simple: SimpleService; - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - super(httpClient, config); - this.simple = new SimpleService(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + const request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + super(request); + this.request = request; + this.simple = new SimpleService(this.request); } }" `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -4376,8 +3369,7 @@ export class ApiError extends Error { `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -4395,47 +3387,48 @@ export type ApiRequestOptions = { `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -4445,26 +3438,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -4493,9 +3466,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -4523,11 +3496,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -4574,13 +3547,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -4635,19 +3608,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -4667,8 +3641,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -4676,236 +3649,121 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; - -export { TestClient } from './client'; -" -`; +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -" -`; +export { Service } from './services/Service'; +export { SimpleService } from './services/SimpleService'; -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ +export { TestClient } from './client'; " `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/services/Service.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ServiceFull } from './ServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class Service { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ServiceFull(httpRequest, clientConfig); } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/services/ServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/services/SimpleService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { SimpleServiceFull } from './SimpleServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class SimpleService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: SimpleServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new SimpleServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/services/SimpleServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class SimpleServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; -exports[`v3 should generate with combined tags: ./test/generated/v3_client_tags_combined/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { Service } from './Service'; -export { ServiceFull } from './ServiceFull'; -export { SimpleService } from './SimpleService'; -export { SimpleServiceFull } from './SimpleServiceFull'; -" -`; - exports[`v3 should generate with exportClient: ./test/generated/v3_client/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { - CollectionFormatService, - ComplexService, - DefaultsService, - DuplicateService, - HeaderService, - MultipartService, - NoContentService, - ParametersService, - RequestBodyService, - ResponseService, - SimpleService, - TypesService, - UploadService, -} from './services'; +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { CollectionFormatService } from './services/CollectionFormatService'; +import { ComplexService } from './services/ComplexService'; +import { DefaultsService } from './services/DefaultsService'; +import { DuplicateService } from './services/DuplicateService'; +import { HeaderService } from './services/HeaderService'; +import { MultipartService } from './services/MultipartService'; +import { NoContentService } from './services/NoContentService'; +import { ParametersService } from './services/ParametersService'; +import { RequestBodyService } from './services/RequestBodyService'; +import { ResponseService } from './services/ResponseService'; +import { SimpleService } from './services/SimpleService'; +import { TypesService } from './services/TypesService'; +import { UploadService } from './services/UploadService'; export class TestClient { readonly collectionformat: CollectionFormatService; @@ -4921,37 +3779,37 @@ export class TestClient { readonly simple: SimpleService; readonly types: TypesService; readonly upload: UploadService; - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - this.collectionformat = new CollectionFormatService(httpClient, config); - this.complex = new ComplexService(httpClient, config); - this.defaults = new DefaultsService(httpClient, config); - this.duplicate = new DuplicateService(httpClient, config); - this.header = new HeaderService(httpClient, config); - this.multipart = new MultipartService(httpClient, config); - this.nocontent = new NoContentService(httpClient, config); - this.parameters = new ParametersService(httpClient, config); - this.requestbody = new RequestBodyService(httpClient, config); - this.response = new ResponseService(httpClient, config); - this.simple = new SimpleService(httpClient, config); - this.types = new TypesService(httpClient, config); - this.upload = new UploadService(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + this.request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + this.collectionformat = new CollectionFormatService(this.request); + this.complex = new ComplexService(this.request); + this.defaults = new DefaultsService(this.request); + this.duplicate = new DuplicateService(this.request); + this.header = new HeaderService(this.request); + this.multipart = new MultipartService(this.request); + this.nocontent = new NoContentService(this.request); + this.parameters = new ParametersService(this.request); + this.requestbody = new RequestBodyService(this.request); + this.response = new ResponseService(this.request); + this.simple = new SimpleService(this.request); + this.types = new TypesService(this.request); + this.upload = new UploadService(this.request); } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -4974,8 +3832,7 @@ export class ApiError extends Error { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -4993,47 +3850,48 @@ export type ApiRequestOptions = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -5043,26 +3901,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -5091,9 +3929,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -5121,11 +3959,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -5172,13 +4010,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -5233,19 +4071,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -5265,8 +4104,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -5274,49 +4112,145 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v3 should generate with exportClient: ./test/generated/v3_client/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; + +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; +export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; +export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export { EnumFromDescription } from './models/EnumFromDescription'; +export { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithStrings } from './models/EnumWithStrings'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum } from './models/ModelWithEnum'; +export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { MultilineComment } from './models/MultilineComment'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $CompositionWithAllOfAndNullable } from './schemas/$CompositionWithAllOfAndNullable'; +export { $CompositionWithAnyOf } from './schemas/$CompositionWithAnyOf'; +export { $CompositionWithAnyOfAndNullable } from './schemas/$CompositionWithAnyOfAndNullable'; +export { $CompositionWithAnyOfAnonymous } from './schemas/$CompositionWithAnyOfAnonymous'; +export { $CompositionWithOneOf } from './schemas/$CompositionWithOneOf'; +export { $CompositionWithOneOfAndNullable } from './schemas/$CompositionWithOneOfAndNullable'; +export { $CompositionWithOneOfAnonymous } from './schemas/$CompositionWithOneOfAnonymous'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $MultilineComment } from './schemas/$MultilineComment'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultsService } from './services/DefaultsService'; +export { DuplicateService } from './services/DuplicateService'; +export { HeaderService } from './services/HeaderService'; +export { MultipartService } from './services/MultipartService'; +export { NoContentService } from './services/NoContentService'; +export { ParametersService } from './services/ParametersService'; +export { RequestBodyService } from './services/RequestBodyService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; +export { UploadService } from './services/UploadService'; export { TestClient } from './client'; " `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5329,8 +4263,7 @@ export type ArrayWithArray = Array>;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithBooleans.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5341,8 +4274,7 @@ export type ArrayWithBooleans = Array;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5353,8 +4285,7 @@ export type ArrayWithNumbers = Array;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5368,8 +4299,7 @@ export type ArrayWithProperties = Array<{ `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithReferences.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5382,8 +4312,7 @@ export type ArrayWithReferences = Array;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ArrayWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5394,8 +4323,7 @@ export type ArrayWithStrings = Array;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithAllOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5415,8 +4343,7 @@ export type CompositionWithAllOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithAnyOf.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5435,8 +4362,7 @@ export type CompositionWithAnyOf = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithAnyOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5456,8 +4382,7 @@ export type CompositionWithAnyOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithAnyOfAnonymous.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5473,8 +4398,7 @@ export type CompositionWithAnyOfAnonymous = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithOneOf.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5493,8 +4417,7 @@ export type CompositionWithOneOf = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithOneOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5514,8 +4437,7 @@ export type CompositionWithOneOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/CompositionWithOneOfAnonymous.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5531,8 +4453,7 @@ export type CompositionWithOneOfAnonymous = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/DictionaryWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5545,8 +4466,7 @@ export type DictionaryWithArray = Record>;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/DictionaryWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5557,8 +4477,7 @@ export type DictionaryWithDictionary = Record>;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/DictionaryWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5572,8 +4491,7 @@ export type DictionaryWithProperties = Record;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/DictionaryWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5598,8 +4515,7 @@ export type DictionaryWithString = Record;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/EnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5614,8 +4530,7 @@ export enum EnumFromDescription { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/EnumWithExtensions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5639,8 +4554,7 @@ export enum EnumWithExtensions { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/EnumWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5667,8 +4581,7 @@ export enum EnumWithNumbers { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/EnumWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5683,8 +4596,7 @@ export enum EnumWithStrings { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelThatExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5701,8 +4613,7 @@ export type ModelThatExtends = (ModelWithString & { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelThatExtendsExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5720,8 +4631,7 @@ export type ModelThatExtendsExtends = (ModelWithString & ModelThatExtends & { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5739,8 +4649,7 @@ export type ModelWithArray = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5757,8 +4666,7 @@ export type ModelWithBoolean = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithCircularReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5772,8 +4680,7 @@ export type ModelWithCircularReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5787,8 +4694,7 @@ export type ModelWithDictionary = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithDuplicateImports.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5806,8 +4712,7 @@ export type ModelWithDuplicateImports = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithDuplicateProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5823,8 +4728,7 @@ export type ModelWithDuplicateProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithEnum.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5875,8 +4779,7 @@ export namespace ModelWithEnum { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithEnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5907,8 +4810,7 @@ export namespace ModelWithEnumFromDescription { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5925,8 +4827,7 @@ export type ModelWithInteger = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithNestedEnums.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5943,8 +4844,7 @@ export type ModelWithNestedEnums = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithNestedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5962,8 +4862,7 @@ export type ModelWithNestedProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithOrderedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5979,8 +4878,7 @@ export type ModelWithOrderedProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -5999,8 +4897,7 @@ export type ModelWithPattern = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6027,8 +4924,7 @@ export type ModelWithProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6044,8 +4940,7 @@ export type ModelWithReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/ModelWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6062,8 +4957,7 @@ export type ModelWithString = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/MultilineComment.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6077,8 +4971,7 @@ export type MultilineComment = number;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6089,8 +4982,7 @@ export type SimpleBoolean = boolean;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleFile.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6101,8 +4993,7 @@ export type SimpleFile = Blob;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6113,8 +5004,7 @@ export type SimpleInteger = number;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6127,8 +5017,7 @@ export type SimpleReference = ModelWithString;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6139,8 +5028,7 @@ export type SimpleString = string;" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/SimpleStringWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6150,64 +5038,8 @@ exports[`v3 should generate with exportClient: ./test/generated/v3_client/models export type SimpleStringWithPattern = string | null;" `; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export type { ArrayWithArray } from './ArrayWithArray'; -export type { ArrayWithBooleans } from './ArrayWithBooleans'; -export type { ArrayWithNumbers } from './ArrayWithNumbers'; -export type { ArrayWithProperties } from './ArrayWithProperties'; -export type { ArrayWithReferences } from './ArrayWithReferences'; -export type { ArrayWithStrings } from './ArrayWithStrings'; -export type { CompositionWithAllOfAndNullable } from './CompositionWithAllOfAndNullable'; -export type { CompositionWithAnyOf } from './CompositionWithAnyOf'; -export type { CompositionWithAnyOfAndNullable } from './CompositionWithAnyOfAndNullable'; -export type { CompositionWithAnyOfAnonymous } from './CompositionWithAnyOfAnonymous'; -export type { CompositionWithOneOf } from './CompositionWithOneOf'; -export type { CompositionWithOneOfAndNullable } from './CompositionWithOneOfAndNullable'; -export type { CompositionWithOneOfAnonymous } from './CompositionWithOneOfAnonymous'; -export type { DictionaryWithArray } from './DictionaryWithArray'; -export type { DictionaryWithDictionary } from './DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './DictionaryWithProperties'; -export type { DictionaryWithReference } from './DictionaryWithReference'; -export type { DictionaryWithString } from './DictionaryWithString'; -export { EnumFromDescription } from './EnumFromDescription'; -export { EnumWithExtensions } from './EnumWithExtensions'; -export { EnumWithNumbers } from './EnumWithNumbers'; -export { EnumWithStrings } from './EnumWithStrings'; -export type { ModelThatExtends } from './ModelThatExtends'; -export type { ModelThatExtendsExtends } from './ModelThatExtendsExtends'; -export type { ModelWithArray } from './ModelWithArray'; -export type { ModelWithBoolean } from './ModelWithBoolean'; -export type { ModelWithCircularReference } from './ModelWithCircularReference'; -export type { ModelWithDictionary } from './ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './ModelWithDuplicateProperties'; -export type { ModelWithEnum } from './ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './ModelWithEnumFromDescription'; -export type { ModelWithInteger } from './ModelWithInteger'; -export type { ModelWithNestedEnums } from './ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './ModelWithNestedProperties'; -export type { ModelWithOrderedProperties } from './ModelWithOrderedProperties'; -export type { ModelWithPattern } from './ModelWithPattern'; -export type { ModelWithProperties } from './ModelWithProperties'; -export type { ModelWithReference } from './ModelWithReference'; -export type { ModelWithString } from './ModelWithString'; -export type { MultilineComment } from './MultilineComment'; -export type { SimpleBoolean } from './SimpleBoolean'; -export type { SimpleFile } from './SimpleFile'; -export type { SimpleInteger } from './SimpleInteger'; -export type { SimpleReference } from './SimpleReference'; -export type { SimpleString } from './SimpleString'; -export type { SimpleStringWithPattern } from './SimpleStringWithPattern'; -" -`; - exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithArray = { @@ -6222,8 +5054,7 @@ export const $ArrayWithArray = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithBooleans.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithBooleans = { @@ -6235,8 +5066,7 @@ export const $ArrayWithBooleans = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithNumbers = { @@ -6248,8 +5078,7 @@ export const $ArrayWithNumbers = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithProperties = { @@ -6268,8 +5097,7 @@ export const $ArrayWithProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithReferences.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithReferences = { @@ -6281,8 +5109,7 @@ export const $ArrayWithReferences = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ArrayWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ArrayWithStrings = { @@ -6294,8 +5121,7 @@ export const $ArrayWithStrings = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithAllOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithAllOfAndNullable = { @@ -6322,8 +5148,7 @@ export const $CompositionWithAllOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithAnyOf.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithAnyOf = { @@ -6345,8 +5170,7 @@ export const $CompositionWithAnyOf = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithAnyOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithAnyOfAndNullable = { @@ -6373,8 +5197,7 @@ export const $CompositionWithAnyOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithAnyOfAnonymous.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithAnyOfAnonymous = { @@ -6399,8 +5222,7 @@ export const $CompositionWithAnyOfAnonymous = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithOneOf.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithOneOf = { @@ -6422,8 +5244,7 @@ export const $CompositionWithOneOf = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithOneOfAndNullable.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithOneOfAndNullable = { @@ -6450,8 +5271,7 @@ export const $CompositionWithOneOfAndNullable = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$CompositionWithOneOfAnonymous.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $CompositionWithOneOfAnonymous = { @@ -6476,8 +5296,7 @@ export const $CompositionWithOneOfAnonymous = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$DictionaryWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithArray = { @@ -6492,8 +5311,7 @@ export const $DictionaryWithArray = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$DictionaryWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithDictionary = { @@ -6508,8 +5326,7 @@ export const $DictionaryWithDictionary = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$DictionaryWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithProperties = { @@ -6528,8 +5345,7 @@ export const $DictionaryWithProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$DictionaryWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithReference = { @@ -6541,8 +5357,7 @@ export const $DictionaryWithReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$DictionaryWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $DictionaryWithString = { @@ -6554,8 +5369,7 @@ export const $DictionaryWithString = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$EnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumFromDescription = { @@ -6564,8 +5378,7 @@ export const $EnumFromDescription = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$EnumWithExtensions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithExtensions = { @@ -6574,8 +5387,7 @@ export const $EnumWithExtensions = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$EnumWithNumbers.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithNumbers = { @@ -6584,8 +5396,7 @@ export const $EnumWithNumbers = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$EnumWithStrings.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $EnumWithStrings = { @@ -6594,8 +5405,7 @@ export const $EnumWithStrings = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelThatExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelThatExtends = { @@ -6616,8 +5426,7 @@ export const $ModelThatExtends = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelThatExtendsExtends.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelThatExtendsExtends = { @@ -6640,8 +5449,7 @@ export const $ModelThatExtendsExtends = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithArray.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithArray = { @@ -6669,8 +5477,7 @@ export const $ModelWithArray = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithBoolean = { @@ -6683,8 +5490,7 @@ export const $ModelWithBoolean = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithCircularReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithCircularReference = { @@ -6697,8 +5503,7 @@ export const $ModelWithCircularReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithDictionary.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDictionary = { @@ -6714,8 +5519,7 @@ export const $ModelWithDictionary = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithDuplicateImports.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDuplicateImports = { @@ -6734,8 +5538,7 @@ export const $ModelWithDuplicateImports = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithDuplicateProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithDuplicateProperties = { @@ -6748,8 +5551,7 @@ export const $ModelWithDuplicateProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithEnum.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithEnum = { @@ -6768,8 +5570,7 @@ export const $ModelWithEnum = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithEnumFromDescription.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithEnumFromDescription = { @@ -6782,8 +5583,7 @@ export const $ModelWithEnumFromDescription = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithInteger = { @@ -6796,8 +5596,7 @@ export const $ModelWithInteger = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithNestedEnums.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithNestedEnums = { @@ -6831,8 +5630,7 @@ export const $ModelWithNestedEnums = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithNestedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithNestedProperties = { @@ -6862,8 +5660,7 @@ export const $ModelWithNestedProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithOrderedProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithOrderedProperties = { @@ -6882,8 +5679,7 @@ export const $ModelWithOrderedProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithPattern = { @@ -6921,8 +5717,7 @@ export const $ModelWithPattern = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithProperties.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithProperties = { @@ -6975,8 +5770,7 @@ export const $ModelWithProperties = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithReference = { @@ -6989,8 +5783,7 @@ export const $ModelWithReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$ModelWithString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $ModelWithString = { @@ -7003,8 +5796,7 @@ export const $ModelWithString = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$MultilineComment.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $MultilineComment = { @@ -7013,8 +5805,7 @@ export const $MultilineComment = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleBoolean.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleBoolean = { @@ -7023,8 +5814,7 @@ export const $SimpleBoolean = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleFile.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleFile = { @@ -7033,8 +5823,7 @@ export const $SimpleFile = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleInteger.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleInteger = { @@ -7043,8 +5832,7 @@ export const $SimpleInteger = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleReference.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleReference = { @@ -7053,8 +5841,7 @@ export const $SimpleReference = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleString.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleString = { @@ -7063,8 +5850,7 @@ export const $SimpleString = { `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/$SimpleStringWithPattern.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export const $SimpleStringWithPattern = { @@ -7075,78 +5861,17 @@ export const $SimpleStringWithPattern = { };" `; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { $ArrayWithArray } from './$ArrayWithArray'; -export { $ArrayWithBooleans } from './$ArrayWithBooleans'; -export { $ArrayWithNumbers } from './$ArrayWithNumbers'; -export { $ArrayWithProperties } from './$ArrayWithProperties'; -export { $ArrayWithReferences } from './$ArrayWithReferences'; -export { $ArrayWithStrings } from './$ArrayWithStrings'; -export { $CompositionWithAllOfAndNullable } from './$CompositionWithAllOfAndNullable'; -export { $CompositionWithAnyOf } from './$CompositionWithAnyOf'; -export { $CompositionWithAnyOfAndNullable } from './$CompositionWithAnyOfAndNullable'; -export { $CompositionWithAnyOfAnonymous } from './$CompositionWithAnyOfAnonymous'; -export { $CompositionWithOneOf } from './$CompositionWithOneOf'; -export { $CompositionWithOneOfAndNullable } from './$CompositionWithOneOfAndNullable'; -export { $CompositionWithOneOfAnonymous } from './$CompositionWithOneOfAnonymous'; -export { $DictionaryWithArray } from './$DictionaryWithArray'; -export { $DictionaryWithDictionary } from './$DictionaryWithDictionary'; -export { $DictionaryWithProperties } from './$DictionaryWithProperties'; -export { $DictionaryWithReference } from './$DictionaryWithReference'; -export { $DictionaryWithString } from './$DictionaryWithString'; -export { $EnumFromDescription } from './$EnumFromDescription'; -export { $EnumWithExtensions } from './$EnumWithExtensions'; -export { $EnumWithNumbers } from './$EnumWithNumbers'; -export { $EnumWithStrings } from './$EnumWithStrings'; -export { $ModelThatExtends } from './$ModelThatExtends'; -export { $ModelThatExtendsExtends } from './$ModelThatExtendsExtends'; -export { $ModelWithArray } from './$ModelWithArray'; -export { $ModelWithBoolean } from './$ModelWithBoolean'; -export { $ModelWithCircularReference } from './$ModelWithCircularReference'; -export { $ModelWithDictionary } from './$ModelWithDictionary'; -export { $ModelWithDuplicateImports } from './$ModelWithDuplicateImports'; -export { $ModelWithDuplicateProperties } from './$ModelWithDuplicateProperties'; -export { $ModelWithEnum } from './$ModelWithEnum'; -export { $ModelWithEnumFromDescription } from './$ModelWithEnumFromDescription'; -export { $ModelWithInteger } from './$ModelWithInteger'; -export { $ModelWithNestedEnums } from './$ModelWithNestedEnums'; -export { $ModelWithNestedProperties } from './$ModelWithNestedProperties'; -export { $ModelWithOrderedProperties } from './$ModelWithOrderedProperties'; -export { $ModelWithPattern } from './$ModelWithPattern'; -export { $ModelWithProperties } from './$ModelWithProperties'; -export { $ModelWithReference } from './$ModelWithReference'; -export { $ModelWithString } from './$ModelWithString'; -export { $MultilineComment } from './$MultilineComment'; -export { $SimpleBoolean } from './$SimpleBoolean'; -export { $SimpleFile } from './$SimpleFile'; -export { $SimpleInteger } from './$SimpleInteger'; -export { $SimpleReference } from './$SimpleReference'; -export { $SimpleString } from './$SimpleString'; -export { $SimpleStringWithPattern } from './$SimpleStringWithPattern'; -" -`; - exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/CollectionFormatService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { CollectionFormatServiceFull } from './CollectionFormatServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class CollectionFormatService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: CollectionFormatServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new CollectionFormatServiceFull(httpRequest, clientConfig); } /** @@ -7155,7 +5880,6 @@ export class CollectionFormatService { * @param parameterArrayTsv This is an array parameter that is send as tsv format (tab-separated values) * @param parameterArrayPipes This is an array parameter that is send as pipes format (pipe-separated values) * @param parameterArrayMulti This is an array parameter that is send as multi format (multiple parameter instances) - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async collectionFormat( @@ -7164,52 +5888,10 @@ export class CollectionFormatService { parameterArrayTsv: Array | null, parameterArrayPipes: Array | null, parameterArrayMulti: Array | null, - config?: ClientConfig ): Promise { - return (await this.full.collectionFormat( - parameterArrayCsv, parameterArraySsv, parameterArrayTsv, parameterArrayPipes, parameterArrayMulti, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/CollectionFormatServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class CollectionFormatServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterArrayCsv This is an array parameter that is send as csv format (comma-separated values) - * @param parameterArraySsv This is an array parameter that is send as ssv format (space-separated values) - * @param parameterArrayTsv This is an array parameter that is send as tsv format (tab-separated values) - * @param parameterArrayPipes This is an array parameter that is send as pipes format (pipe-separated values) - * @param parameterArrayMulti This is an array parameter that is send as multi format (multiple parameter instances) - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async collectionFormat( - parameterArrayCsv: Array | null, - parameterArraySsv: Array | null, - parameterArrayTsv: Array | null, - parameterArrayPipes: Array | null, - parameterArrayMulti: Array | null, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/collectionFormat\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/collectionFormat\`, query: { 'parameterArrayCSV': parameterArrayCsv, 'parameterArraySSV': parameterArraySsv, @@ -7217,41 +5899,33 @@ export class CollectionFormatServiceFull { 'parameterArrayPipes': parameterArrayPipes, 'parameterArrayMulti': parameterArrayMulti, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ComplexService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithArray, - ModelWithDictionary, - ModelWithEnum, - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ComplexServiceFull } from './ComplexServiceFull'; +import type { ModelWithArray } from '../models/ModelWithArray'; +import type { ModelWithDictionary } from '../models/ModelWithDictionary'; +import type { ModelWithEnum } from '../models/ModelWithEnum'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class ComplexService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ComplexServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ComplexServiceFull(httpRequest, clientConfig); } /** * @param parameterObject Parameter containing object * @param parameterReference Parameter containing reference - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Successful response * @throws ApiError */ @@ -7264,88 +5938,10 @@ export class ComplexService { }, }, parameterReference: ModelWithString, - config?: ClientConfig ): Promise> { - return (await this.full.complexTypes( - parameterObject, parameterReference, config - )).body; - } - - /** - * @param id - * @param requestBody - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Success - * @throws ApiError - */ - public async complexParams( - id: number, - requestBody?: { - readonly key: string | null, - name: string | null, - enabled: boolean, - readonly type: 'Monkey' | 'Horse' | 'Bird', - listOfModels?: Array | null, - listOfStrings?: Array | null, - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary), - readonly user?: { - readonly id?: number, - readonly name?: string | null, - }, - }, - config?: ClientConfig - ): Promise { - return (await this.full.complexParams( - id, requestBody, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ComplexServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithArray, - ModelWithDictionary, - ModelWithEnum, - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ComplexServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterObject Parameter containing object - * @param parameterReference Parameter containing reference - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Successful response - * @throws ApiError - */ - public async complexTypes( - parameterObject: { - first?: { - second?: { - third?: string, - }, - }, - }, - parameterReference: ModelWithString, - config?: ClientConfig - ): Promise>> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/complex\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/complex\`, query: { 'parameterObject': parameterObject, 'parameterReference': parameterReference, @@ -7354,13 +5950,13 @@ export class ComplexServiceFull { 400: \`400 server error\`, 500: \`500 server error\`, }, - }, this.clientConfig, config); + }); + return result.body; } /** * @param id * @param requestBody - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Success * @throws ApiError */ @@ -7379,39 +5975,31 @@ export class ComplexServiceFull { readonly name?: string | null, }, }, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/complex/\${id}\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/complex/\${id}\`, body: requestBody, mediaType: 'application/json-patch+json', - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/DefaultsService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { DefaultsServiceFull } from './DefaultsServiceFull'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class DefaultsService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: DefaultsServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new DefaultsServiceFull(httpRequest, clientConfig); } /** @@ -7420,7 +6008,6 @@ export class DefaultsService { * @param parameterBoolean This is a simple boolean with default value * @param parameterEnum This is a simple enum with default value * @param parameterModel This is a simple model with default value - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithDefaultParameters( @@ -7431,105 +6018,10 @@ export class DefaultsService { parameterModel: ModelWithString | null = { \\"prop\\": \\"Hello World!\\" }, - config?: ClientConfig ): Promise { - return (await this.full.callWithDefaultParameters( - parameterString, parameterNumber, parameterBoolean, parameterEnum, parameterModel, config - )).body; - } - - /** - * @param parameterString This is a simple string that is optional with default value - * @param parameterNumber This is a simple number that is optional with default value - * @param parameterBoolean This is a simple boolean that is optional with default value - * @param parameterEnum This is a simple enum that is optional with default value - * @param parameterModel This is a simple model that is optional with default value - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithDefaultOptionalParameters( - parameterString: string = 'Hello World!', - parameterNumber: number = 123, - parameterBoolean: boolean = true, - parameterEnum: 'Success' | 'Warning' | 'Error' = 'Success', - parameterModel: ModelWithString = { - \\"prop\\": \\"Hello World!\\" - }, - config?: ClientConfig - ): Promise { - return (await this.full.callWithDefaultOptionalParameters( - parameterString, parameterNumber, parameterBoolean, parameterEnum, parameterModel, config - )).body; - } - - /** - * @param parameterStringWithNoDefault This is a string with no default - * @param parameterOptionalStringWithDefault This is a optional string with default - * @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default - * @param parameterOptionalStringWithNoDefault This is a optional string with no default - * @param parameterStringWithDefault This is a string with default - * @param parameterStringWithEmptyDefault This is a string with empty default - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callToTestOrderOfParams( - parameterStringWithNoDefault: string, - parameterOptionalStringWithDefault: string = 'Hello World!', - parameterOptionalStringWithEmptyDefault: string = '', - parameterOptionalStringWithNoDefault?: string, - parameterStringWithDefault: string = 'Hello World!', - parameterStringWithEmptyDefault: string = '', - config?: ClientConfig - ): Promise { - return (await this.full.callToTestOrderOfParams( - parameterStringWithNoDefault, parameterOptionalStringWithDefault, parameterOptionalStringWithEmptyDefault, parameterOptionalStringWithNoDefault, parameterStringWithDefault, parameterStringWithEmptyDefault, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/DefaultsServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class DefaultsServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterString This is a simple string with default value - * @param parameterNumber This is a simple number with default value - * @param parameterBoolean This is a simple boolean with default value - * @param parameterEnum This is a simple enum with default value - * @param parameterModel This is a simple model with default value - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithDefaultParameters( - parameterString: string | null = 'Hello World!', - parameterNumber: number | null = 123, - parameterBoolean: boolean | null = true, - parameterEnum: 'Success' | 'Warning' | 'Error' = 'Success', - parameterModel: ModelWithString | null = { - \\"prop\\": \\"Hello World!\\" - }, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterString': parameterString, 'parameterNumber': parameterNumber, @@ -7537,7 +6029,8 @@ export class DefaultsServiceFull { 'parameterEnum': parameterEnum, 'parameterModel': parameterModel, }, - }, this.clientConfig, config); + }); + return result.body; } /** @@ -7546,7 +6039,6 @@ export class DefaultsServiceFull { * @param parameterBoolean This is a simple boolean that is optional with default value * @param parameterEnum This is a simple enum that is optional with default value * @param parameterModel This is a simple model that is optional with default value - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithDefaultOptionalParameters( @@ -7557,11 +6049,10 @@ export class DefaultsServiceFull { parameterModel: ModelWithString = { \\"prop\\": \\"Hello World!\\" }, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterString': parameterString, 'parameterNumber': parameterNumber, @@ -7569,7 +6060,8 @@ export class DefaultsServiceFull { 'parameterEnum': parameterEnum, 'parameterModel': parameterModel, }, - }, this.clientConfig, config); + }); + return result.body; } /** @@ -7579,7 +6071,6 @@ export class DefaultsServiceFull { * @param parameterOptionalStringWithNoDefault This is a optional string with no default * @param parameterStringWithDefault This is a string with default * @param parameterStringWithEmptyDefault This is a string with empty default - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callToTestOrderOfParams( @@ -7589,11 +6080,10 @@ export class DefaultsServiceFull { parameterOptionalStringWithNoDefault?: string, parameterStringWithDefault: string = 'Hello World!', parameterStringWithEmptyDefault: string = '', - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/defaults\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/defaults\`, query: { 'parameterStringWithNoDefault': parameterStringWithNoDefault, 'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault, @@ -7602,460 +6092,180 @@ export class DefaultsServiceFull { 'parameterStringWithDefault': parameterStringWithDefault, 'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/DuplicateService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { DuplicateServiceFull } from './DuplicateServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class DuplicateService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: DuplicateServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new DuplicateServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName(config?: ClientConfig): Promise { - return (await this.full.duplicateName(config)).body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName1(config?: ClientConfig): Promise { - return (await this.full.duplicateName1(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName2(config?: ClientConfig): Promise { - return (await this.full.duplicateName2(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName3(config?: ClientConfig): Promise { - return (await this.full.duplicateName3(config)).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/DuplicateServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class DuplicateServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async duplicateName(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async duplicateName(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName1(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async duplicateName1(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName2(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async duplicateName2(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async duplicateName3(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async duplicateName3(): Promise { + const result = await this.httpRequest.request({ method: 'DELETE', - path: \`/api/v\${this.clientConfig.version}/duplicate\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/duplicate\`, + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/HeaderService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { HeaderServiceFull } from './HeaderServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class HeaderService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: HeaderServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new HeaderServiceFull(httpRequest, clientConfig); - } + private httpRequest: BaseHttpRequest; - /** - * @param [config] the optional OpenAPI config to use - * @returns string Successful response - * @throws ApiError - */ - public async callWithResultFromHeader(config?: ClientConfig): Promise { - return (await this.full.callWithResultFromHeader(config)).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/HeaderServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class HeaderServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @returns string Successful response * @throws ApiError */ - public async callWithResultFromHeader(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithResultFromHeader(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/header\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/header\`, responseHeader: 'operation-location', errors: { 400: \`400 server error\`, 500: \`500 server error\`, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/MultipartService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { MultipartServiceFull } from './MultipartServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class MultipartService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: MultipartServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new MultipartServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns any OK - * @throws ApiError - */ - public async multipartResponse(config?: ClientConfig): Promise<{ - file?: string, - metadata?: { - foo?: string, - bar?: string, - }, - }> { - return (await this.full.multipartResponse(config)).body; - } + private httpRequest: BaseHttpRequest; -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/MultipartServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class MultipartServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } - /** - * @param [config] the optional OpenAPI config to use - * @returns any OK - * @throws ApiError - */ - public async multipartResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'GET', - path: \`/api/v\${this.clientConfig.version}/multipart\`, - }, this.clientConfig, config); - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/NoContentService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { NoContentServiceFull } from './NoContentServiceFull'; - -export class NoContentService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: NoContentServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new NoContentServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns void - * @throws ApiError - */ - public async callWithNoContentResponse(config?: ClientConfig): Promise { - return (await this.full.callWithNoContentResponse(config)).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/NoContentServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class NoContentServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns void - * @throws ApiError - */ - public async callWithNoContentResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ - method: 'GET', - path: \`/api/v\${this.clientConfig.version}/no-content\`, - }, this.clientConfig, config); - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ParametersService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ParametersServiceFull } from './ParametersServiceFull'; - -export class ParametersService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ParametersServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ParametersServiceFull(httpRequest, clientConfig); - } - - /** - * @param parameterHeader This is the parameter that goes into the header - * @param parameterQuery This is the parameter that goes into the query params - * @param parameterForm This is the parameter that goes into the form data - * @param parameterCookie This is the parameter that goes into the cookie - * @param parameterPath This is the parameter that goes into the path - * @param requestBody This is the parameter that goes into the body - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithParameters( - parameterHeader: string | null, - parameterQuery: string | null, - parameterForm: string | null, - parameterCookie: string | null, - parameterPath: string | null, - requestBody: ModelWithString | null, - config?: ClientConfig - ): Promise { - return (await this.full.callWithParameters( - parameterHeader, parameterQuery, parameterForm, parameterCookie, parameterPath, requestBody, config - )).body; - } - - /** - * @param parameterHeader This is the parameter that goes into the request header - * @param parameterQuery This is the parameter that goes into the request query params - * @param parameterForm This is the parameter that goes into the request form data - * @param parameterCookie This is the parameter that goes into the cookie - * @param requestBody This is the parameter that goes into the body - * @param parameterPath1 This is the parameter that goes into the path - * @param parameterPath2 This is the parameter that goes into the path - * @param parameterPath3 This is the parameter that goes into the path - * @param _default This is the parameter with a reserved keyword - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async callWithWeirdParameterNames( - parameterHeader: string | null, - parameterQuery: string | null, - parameterForm: string | null, - parameterCookie: string | null, - requestBody: ModelWithString | null, - parameterPath1?: string, - parameterPath2?: string, - parameterPath3?: string, - _default?: string, - config?: ClientConfig - ): Promise { - return (await this.full.callWithWeirdParameterNames( - parameterHeader, parameterQuery, parameterForm, parameterCookie, requestBody, parameterPath1, parameterPath2, parameterPath3, _default, config - )).body; - } - - /** - * @param requestBody This is a required parameter - * @param parameter This is an optional parameter - * @param [config] the optional OpenAPI config to use + /** + * @returns any OK * @throws ApiError */ - public async getCallWithOptionalParam( - requestBody: ModelWithString, - parameter?: string, - config?: ClientConfig - ): Promise { - return (await this.full.getCallWithOptionalParam( - requestBody, parameter, config - )).body; + public async multipartResponse(): Promise<{ + file?: string, + metadata?: { + foo?: string, + bar?: string, + }, + }> { + const result = await this.httpRequest.request({ + method: 'GET', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/multipart\`, + }); + return result.body; + } + +}" +`; + +exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/NoContentService.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class NoContentService { + private httpRequest: BaseHttpRequest; + + constructor(httpRequest: BaseHttpRequest) { + this.httpRequest = httpRequest; } /** - * @param parameter This is a required parameter - * @param requestBody This is an optional parameter - * @param [config] the optional OpenAPI config to use + * @returns void * @throws ApiError */ - public async postCallWithOptionalParam( - parameter: string, - requestBody?: ModelWithString, - config?: ClientConfig - ): Promise { - return (await this.full.postCallWithOptionalParam( - parameter, requestBody, config - )).body; + public async callWithNoContentResponse(): Promise { + const result = await this.httpRequest.request({ + method: 'GET', + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/no-content\`, + }); + return result.body; } }" `; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ParametersServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ParametersService.ts 1`] = ` +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; -export class ParametersServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; +export class ParametersService { + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** @@ -8065,7 +6275,6 @@ export class ParametersServiceFull { * @param parameterCookie This is the parameter that goes into the cookie * @param parameterPath This is the parameter that goes into the path * @param requestBody This is the parameter that goes into the body - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithParameters( @@ -8075,11 +6284,10 @@ export class ParametersServiceFull { parameterCookie: string | null, parameterPath: string | null, requestBody: ModelWithString | null, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/parameters/\${parameterPath}\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\${parameterPath}\`, cookies: { 'parameterCookie': parameterCookie, }, @@ -8094,7 +6302,8 @@ export class ParametersServiceFull { }, body: requestBody, mediaType: 'application/json', - }, this.clientConfig, config); + }); + return result.body; } /** @@ -8107,7 +6316,6 @@ export class ParametersServiceFull { * @param parameterPath2 This is the parameter that goes into the path * @param parameterPath3 This is the parameter that goes into the path * @param _default This is the parameter with a reserved keyword - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async callWithWeirdParameterNames( @@ -8120,11 +6328,10 @@ export class ParametersServiceFull { parameterPath2?: string, parameterPath3?: string, _default?: string, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/parameters/\${parameterPath1}/\${parameterPath2}/\${parameterPath3}\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\${parameterPath1}/\${parameterPath2}/\${parameterPath3}\`, cookies: { 'PARAMETER-COOKIE': parameterCookie, }, @@ -8140,463 +6347,264 @@ export class ParametersServiceFull { }, body: requestBody, mediaType: 'application/json', - }, this.clientConfig, config); + }); + return result.body; } /** * @param requestBody This is a required parameter * @param parameter This is an optional parameter - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async getCallWithOptionalParam( requestBody: ModelWithString, parameter?: string, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/parameters/\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\`, query: { 'parameter': parameter, }, body: requestBody, mediaType: 'application/json', - }, this.clientConfig, config); + }); + return result.body; } /** * @param parameter This is a required parameter * @param requestBody This is an optional parameter - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async postCallWithOptionalParam( parameter: string, requestBody?: ModelWithString, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + ): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/parameters/\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/parameters/\`, query: { 'parameter': parameter, }, body: requestBody, mediaType: 'application/json', - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/RequestBodyService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { RequestBodyServiceFull } from './RequestBodyServiceFull'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class RequestBodyService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: RequestBodyServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new RequestBodyServiceFull(httpRequest, clientConfig); } /** * @param requestBody A reusable request body - * @param [config] the optional OpenAPI config to use * @throws ApiError */ public async postRequestBodyService( requestBody?: ModelWithString, - config?: ClientConfig ): Promise { - return (await this.full.postRequestBodyService( - requestBody, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/RequestBodyServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class RequestBodyServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param requestBody A reusable request body - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postRequestBodyService( - requestBody?: ModelWithString, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/requestBody/\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/requestBody/\`, body: requestBody, mediaType: 'application/json', - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ResponseService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { - ModelThatExtends, - ModelThatExtendsExtends, - ModelWithString, -} from '../models'; -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ResponseServiceFull } from './ResponseServiceFull'; +import type { ModelThatExtends } from '../models/ModelThatExtends'; +import type { ModelThatExtendsExtends } from '../models/ModelThatExtendsExtends'; +import type { ModelWithString } from '../models/ModelWithString'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class ResponseService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ResponseServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ResponseServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString - * @throws ApiError - */ - public async callWithResponse(config?: ClientConfig): Promise { - return (await this.full.callWithResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public async callWithDuplicateResponses(config?: ClientConfig): Promise { - return (await this.full.callWithDuplicateResponses(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public async callWithResponses(config?: ClientConfig): Promise<{ - readonly '@namespace.string'?: string, - readonly '@namespace.integer'?: number, - readonly value?: Array, - } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends> { - return (await this.full.callWithResponses(config)).body; - } - -}" -`; + private httpRequest: BaseHttpRequest; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/ResponseServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { - ModelThatExtends, - ModelThatExtendsExtends, - ModelWithString, -} from '../models'; -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class ResponseServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @returns ModelWithString * @throws ApiError */ - public async callWithResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/response\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @returns ModelWithString Message for default response * @throws ApiError */ - public async callWithDuplicateResponses(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async callWithDuplicateResponses(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/response\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, errors: { 500: \`Message for 500 error\`, 501: \`Message for 501 error\`, 502: \`Message for 502 error\`, }, - }, this.clientConfig, config); + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @returns any Message for 200 response * @returns ModelWithString Message for default response * @returns ModelThatExtends Message for 201 response * @returns ModelThatExtendsExtends Message for 202 response * @throws ApiError */ - public async callWithResponses(config?: ClientConfig): Promise, - } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends>> { - return this.httpRequest.request({ + } | ModelWithString | ModelThatExtends | ModelThatExtendsExtends> { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/response\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/response\`, errors: { 500: \`Message for 500 error\`, 501: \`Message for 501 error\`, 502: \`Message for 502 error\`, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/SimpleService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { SimpleServiceFull } from './SimpleServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class SimpleService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: SimpleServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new SimpleServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async deleteCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.deleteCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async optionsCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.optionsCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async headCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.headCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async patchCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.patchCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/SimpleServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class SimpleServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async deleteCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async deleteCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'DELETE', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async optionsCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async optionsCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'OPTIONS', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async headCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async headCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'HEAD', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async patchCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async patchCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PATCH', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/TypesService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { TypesServiceFull } from './TypesServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class TypesService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: TypesServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new TypesServiceFull(httpRequest, clientConfig); } /** @@ -8608,7 +6616,6 @@ export class TypesService { * @param parameterBoolean This is a boolean parameter * @param parameterObject This is an object parameter * @param id This is a number parameter - * @param [config] the optional OpenAPI config to use * @returns number Response is a simple number * @returns string Response is a simple string * @returns boolean Response is a simple boolean @@ -8624,62 +6631,10 @@ export class TypesService { parameterBoolean: boolean | null = true, parameterObject: any = null, id?: number, - config?: ClientConfig ): Promise { - return (await this.full.types( - parameterArray, parameterDictionary, parameterEnum, parameterNumber, parameterString, parameterBoolean, parameterObject, id, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/TypesServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class TypesServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param parameterArray This is an array parameter - * @param parameterDictionary This is a dictionary parameter - * @param parameterEnum This is an enum parameter - * @param parameterNumber This is a number parameter - * @param parameterString This is a string parameter - * @param parameterBoolean This is a boolean parameter - * @param parameterObject This is an object parameter - * @param id This is a number parameter - * @param [config] the optional OpenAPI config to use - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns any Response is a simple object - * @throws ApiError - */ - public async types( - parameterArray: Array | null, - parameterDictionary: any, - parameterEnum: 'Success' | 'Warning' | 'Error' | null, - parameterNumber: number = 123, - parameterString: string | null = 'default', - parameterBoolean: boolean | null = true, - parameterObject: any = null, - id?: number, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/types\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/types\`, query: { 'parameterArray': parameterArray, 'parameterDictionary': parameterDictionary, @@ -8689,151 +6644,77 @@ export class TypesServiceFull { 'parameterBoolean': parameterBoolean, 'parameterObject': parameterObject, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/UploadService.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { UploadServiceFull } from './UploadServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class UploadService { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: UploadServiceFull; + private httpRequest: BaseHttpRequest; - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new UploadServiceFull(httpRequest, clientConfig); } /** * @param file Supply a file reference for upload - * @param [config] the optional OpenAPI config to use * @returns boolean * @throws ApiError */ public async uploadFile( file: Blob, - config?: ClientConfig ): Promise { - return (await this.full.uploadFile( - file, config - )).body; - } - -}" -`; - -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/UploadServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; - -export class UploadServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - } - - /** - * @param file Supply a file reference for upload - * @param [config] the optional OpenAPI config to use - * @returns boolean - * @throws ApiError - */ - public async uploadFile( - file: Blob, - config?: ClientConfig - ): Promise> { - return this.httpRequest.request({ + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/upload\`, + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/upload\`, formData: { 'file': file, }, - }, this.clientConfig, config); + }); + return result.body; } }" `; -exports[`v3 should generate with exportClient: ./test/generated/v3_client/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { CollectionFormatService } from './CollectionFormatService'; -export { CollectionFormatServiceFull } from './CollectionFormatServiceFull'; -export { ComplexService } from './ComplexService'; -export { ComplexServiceFull } from './ComplexServiceFull'; -export { DefaultsService } from './DefaultsService'; -export { DefaultsServiceFull } from './DefaultsServiceFull'; -export { DuplicateService } from './DuplicateService'; -export { DuplicateServiceFull } from './DuplicateServiceFull'; -export { HeaderService } from './HeaderService'; -export { HeaderServiceFull } from './HeaderServiceFull'; -export { MultipartService } from './MultipartService'; -export { MultipartServiceFull } from './MultipartServiceFull'; -export { NoContentService } from './NoContentService'; -export { NoContentServiceFull } from './NoContentServiceFull'; -export { ParametersService } from './ParametersService'; -export { ParametersServiceFull } from './ParametersServiceFull'; -export { RequestBodyService } from './RequestBodyService'; -export { RequestBodyServiceFull } from './RequestBodyServiceFull'; -export { ResponseService } from './ResponseService'; -export { ResponseServiceFull } from './ResponseServiceFull'; -export { SimpleService } from './SimpleService'; -export { SimpleServiceFull } from './SimpleServiceFull'; -export { TypesService } from './TypesService'; -export { TypesServiceFull } from './TypesServiceFull'; -export { UploadService } from './UploadService'; -export { UploadServiceFull } from './UploadServiceFull'; -" -`; - exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/client.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest } from './core'; -import { FetchHttpRequest } from './core'; -import type { ClientConfig } from './core'; -import { Service } from './services'; +import { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; +import { Service } from './services/Service'; export class TestClient extends Service { - - constructor(clientConfig: ClientConfig, httpClient: BaseHttpRequest = new FetchHttpRequest()) { - const config = { - baseUrl: clientConfig?.baseUrl ?? 'http://localhost:3000/base', - version: clientConfig?.version ?? '1.0', - withCredentials: clientConfig?.withCredentials ?? false, - token: clientConfig?.token, - username: clientConfig?.username, - password: clientConfig?.password, - headers: clientConfig?.headers, - } - super(httpClient, config); + readonly request: BaseHttpRequest; + + constructor(openApiConfig?: OpenAPIConfig, HttpRequest: new (config: OpenAPIConfig) => BaseHttpRequest = FetchHttpRequest) { + const request = new HttpRequest({ + BASE: openApiConfig?.BASE ?? 'http://localhost:3000/base', + VERSION: openApiConfig?.VERSION ?? '1.0', + WITH_CREDENTIALS: openApiConfig?.WITH_CREDENTIALS ?? false, + TOKEN: openApiConfig?.TOKEN, + USERNAME: openApiConfig?.USERNAME, + PASSWORD: openApiConfig?.PASSWORD, + HEADERS: openApiConfig?.HEADERS, + }); + super(request); + this.request = request; } }" `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/ApiError.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiResult } from './ApiResult'; @@ -8856,8 +6737,7 @@ export class ApiError extends Error { `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/ApiRequestOptions.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { @@ -8875,47 +6755,48 @@ export type ApiRequestOptions = { `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/ApiResult.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { +export type ApiResult = { readonly url: string; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: T; + readonly body: any; }" `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/BaseHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; - -export interface BaseHttpRequest { - request( - options: ApiRequestOptions, - config: ClientConfig, - mergeConfig?: ClientConfig - ): Promise>; +import type { OpenAPIConfig } from './OpenAPI'; + +export class BaseHttpRequest { + readonly openApiConfig: OpenAPIConfig; + + constructor(openApiConfig: OpenAPIConfig) { + this.openApiConfig = openApiConfig; + } + + async request(options: ApiRequestOptions): Promise { + throw new Error('Not Implemented'); + } }" `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/FetchHttpRequest.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import { ApiError } from './ApiError'; import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; -import type { ClientConfig } from './OpenAPI'; -import type { BaseHttpRequest } from './BaseHttpRequest'; +import type { OpenAPIConfig } from './OpenAPI'; +import { BaseHttpRequest } from './BaseHttpRequest'; function isDefined(value: T | null | undefined): value is Exclude { return value !== undefined && value !== null; @@ -8925,26 +6806,6 @@ function isString(value: any): value is string { return typeof value === 'string'; } -export function deepAssign( - target: Record, - source: Record, -): Record { - const keys = Object.keys(source); - for (const k of keys) { - const sourceValue: unknown = source[k]; - const targetValue: unknown = target[k]; - if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) { - target[k] = deepAssign( - targetValue as Record, - sourceValue as Record, - ); - } else { - target[k] = source[k]; - } - } - return target; -} - function isStringWithValue(value: any): value is string { return isString(value) && value !== ''; } @@ -8973,9 +6834,9 @@ function getQueryString(params: Record): string { return ''; } -function getUrl(options: ApiRequestOptions, config: ClientConfig): string { +function getUrl(options: ApiRequestOptions, config: OpenAPIConfig): string { const path = options.path.replace(/[:]/g, '_'); - const url = \`\${config.baseUrl}\${path}\`; + const url = \`\${config.BASE}\${path}\`; if (options.query) { return \`\${url}\${getQueryString(options.query)}\`; @@ -9003,11 +6864,11 @@ async function resolve(options: ApiRequestOptions, resolver?: T | Resolver return resolver; } -async function getHeaders(options: ApiRequestOptions, config: ClientConfig): Promise { - const token = await resolve(options, config.token); - const username = await resolve(options, config.username); - const password = await resolve(options, config.password); - const defaultHeaders = await resolve(options, config.headers); +async function getHeaders(options: ApiRequestOptions, config: OpenAPIConfig): Promise { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const defaultHeaders = await resolve(options, config.HEADERS); const headers = new Headers({ Accept: 'application/json', @@ -9054,13 +6915,13 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined { return undefined; } -async function sendRequest(options: ApiRequestOptions, config: ClientConfig, url: string): Promise { +async function sendRequest(options: ApiRequestOptions, config: OpenAPIConfig, url: string): Promise { const request: RequestInit = { method: options.method, headers: await getHeaders(options, config), body: getRequestBody(options), }; - if (config.withCredentials) { + if (config.WITH_CREDENTIALS) { request.credentials = 'include'; } return await fetch(url, request); @@ -9115,19 +6976,20 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void { } } -export class FetchHttpRequest implements BaseHttpRequest { +export class FetchHttpRequest extends BaseHttpRequest { + constructor(openApiConfig: OpenAPIConfig) { + super(openApiConfig); + } + /** * Request using fetch client * @param options The request options from the the service - * @param config The OpenAPI configuration - * @param [mergeConfig] Additional optional OpenAPI configuration that will be merged with the first one * @returns ApiResult * @throws ApiError */ - async request(options: ApiRequestOptions, config: ClientConfig, mergeConfig?: ClientConfig): Promise { - const conf = mergeConfig ? deepAssign(config, mergeConfig) : config; - const url = getUrl(options, conf); - const response = await sendRequest(options, conf, url); + async request(options: ApiRequestOptions): Promise { + const url = getUrl(options, this.openApiConfig); + const response = await sendRequest(options, this.openApiConfig, url); const responseBody = await getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); @@ -9147,8 +7009,7 @@ export class FetchHttpRequest implements BaseHttpRequest { `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/OpenAPI.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; @@ -9156,166 +7017,80 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; -export type ClientConfig = { - baseUrl?: string; - version?: string; - withCredentials?: boolean; - token?: string | Resolver; - username?: string | Resolver; - password?: string | Resolver; - headers?: Headers | Resolver; +export type OpenAPIConfig = { + BASE?: string; + VERSION?: string; + WITH_CREDENTIALS?: boolean; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; } " `; -exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/core/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { ApiError } from './ApiError'; -export type { ApiRequestOptions } from './ApiRequestOptions'; -export type { ApiResult } from './ApiResult'; -export type { BaseHttpRequest } from './BaseHttpRequest'; -export { FetchHttpRequest } from './FetchHttpRequest'; -export type { ClientConfig } from './OpenAPI'; -" -`; - exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export * from './core'; -export * from './models'; -export * from './schemas'; -export * from './services'; - -export { TestClient } from './client'; -" -`; +export { ApiError } from './core/ApiError'; +export type { ApiRequestOptions } from './core/ApiRequestOptions'; +export type { ApiResult } from './core/ApiResult'; +export type { OpenAPIConfig } from './core/OpenAPI'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { FetchHttpRequest } from './core/FetchHttpRequest'; -exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/models/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -" -`; +export { Service } from './services/Service'; -exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/schemas/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ +export { TestClient } from './client'; " `; exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/services/Service.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ +"/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseHttpRequest, ClientConfig } from '../core'; -import { ServiceFull } from './ServiceFull'; +import { BaseHttpRequest } from '../core/BaseHttpRequest'; export class Service { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - readonly full: ServiceFull; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { - this.httpRequest = httpRequest; - this.clientConfig = clientConfig; - this.full = new ServiceFull(httpRequest, clientConfig); - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.getCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.putCallWithoutParametersAndResponse(config)).body; - } - - /** - * @param [config] the optional OpenAPI config to use - * @throws ApiError - */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise { - return (await this.full.postCallWithoutParametersAndResponse(config)).body; - } - -}" -`; - -exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/services/ServiceFull.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; + private httpRequest: BaseHttpRequest; -export class ServiceFull { - private readonly httpRequest: BaseHttpRequest; - private readonly clientConfig: ClientConfig; - - constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { + constructor(httpRequest: BaseHttpRequest) { this.httpRequest = httpRequest; - this.clientConfig = clientConfig; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async getCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async getCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'GET', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async putCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async putCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'PUT', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } /** - * @param [config] the optional OpenAPI config to use * @throws ApiError */ - public async postCallWithoutParametersAndResponse(config?: ClientConfig): Promise> { - return this.httpRequest.request({ + public async postCallWithoutParametersAndResponse(): Promise { + const result = await this.httpRequest.request({ method: 'POST', - path: \`/api/v\${this.clientConfig.version}/simple\`, - }, this.clientConfig, config); + path: \`/api/v\${this.httpRequest.openApiConfig.VERSION}/simple\`, + }); + return result.body; } }" `; - -exports[`v3 should generate with no tags: ./test/generated/v3_client_no_tags/services/index.ts 1`] = ` -"/* DO NOT EDIT THIS FILE, IT IS GENERATED FROM THE OPEN API SPECIFICATION */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export { Service } from './Service'; -export { ServiceFull } from './ServiceFull'; -" -`; diff --git a/test/spec/v2_no_tags.json b/test/spec/v2_no_tags.json index f4db4ce10..4e9659b37 100644 --- a/test/spec/v2_no_tags.json +++ b/test/spec/v2_no_tags.json @@ -6,9 +6,7 @@ }, "host": "localhost:3000", "basePath": "/base", - "schemes": [ - "http" - ], + "schemes": ["http"], "paths": { "/api/v{api-version}/simple": { "get": {