From 4ec176faf44b55df86c28db0db8ff971414d9a6a Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 2 May 2024 11:00:05 +0100 Subject: [PATCH] chore: export only one service type per operation --- .../src/client/services.gen.ts | 130 +++++++++--------- .../openapi-ts-fetch/src/client/types.gen.ts | 69 +++++----- packages/openapi-ts/src/openApi/v2/index.ts | 1 + packages/openapi-ts/src/openApi/v3/index.ts | 1 + packages/openapi-ts/src/types/client.ts | 3 + packages/openapi-ts/src/utils/postprocess.ts | 1 + .../src/utils/write/__tests__/class.spec.ts | 1 + .../src/utils/write/__tests__/client.spec.ts | 1 + .../src/utils/write/__tests__/core.spec.ts | 3 + .../src/utils/write/__tests__/models.spec.ts | 1 + .../utils/write/__tests__/services.spec.ts | 1 + .../openapi-ts/src/utils/write/services.ts | 12 +- packages/openapi-ts/src/utils/write/types.ts | 70 +++++----- .../test/generated/v2/services.gen.ts.snap | 48 +++---- .../test/generated/v2/types.gen.ts.snap | 54 ++++---- .../test/generated/v3/services.gen.ts.snap | 74 +++++----- .../test/generated/v3/types.gen.ts.snap | 88 ++++++------ .../generated/v3_angular/services.gen.ts.snap | 74 +++++----- .../generated/v3_angular/types.gen.ts.snap | 88 ++++++------ .../generated/v3_client/services.gen.ts.snap | 74 +++++----- .../generated/v3_client/types.gen.ts.snap | 88 ++++++------ .../v3_enums_typescript/services.gen.ts.snap | 74 +++++----- .../v3_enums_typescript/types.gen.ts.snap | 88 ++++++------ .../services.gen.ts.snap | 8 +- .../types.gen.ts.snap | 6 +- .../generated/v3_options/services.gen.ts.snap | 8 +- .../generated/v3_options/types.gen.ts.snap | 6 +- .../v3_services_name/services.gen.ts.snap | 12 +- 28 files changed, 521 insertions(+), 563 deletions(-) diff --git a/examples/openapi-ts-fetch/src/client/services.gen.ts b/examples/openapi-ts-fetch/src/client/services.gen.ts index a1b27cc91..eef1e7bf0 100644 --- a/examples/openapi-ts-fetch/src/client/services.gen.ts +++ b/examples/openapi-ts-fetch/src/client/services.gen.ts @@ -5,38 +5,38 @@ import { OpenAPI } from '@hey-api/client-fetch'; import { request as __request } from '@hey-api/client-fetch'; import type { - PetAddPetData, - PetAddPetResponse, - PetDeletePetData, - PetFindPetsByStatusData, - PetFindPetsByStatusResponse, - PetFindPetsByTagsData, - PetFindPetsByTagsResponse, - PetGetPetByIdData, - PetGetPetByIdResponse, - PetUpdatePetData, - PetUpdatePetResponse, - PetUpdatePetWithFormData, - PetUploadFileData, - PetUploadFileResponse, - StoreDeleteOrderData, - StoreGetInventoryResponse, - StoreGetOrderByIdData, - StoreGetOrderByIdResponse, - StorePlaceOrderData, - StorePlaceOrderResponse, - UserCreateUserData, - UserCreateUserResponse, - UserCreateUsersWithListInputData, - UserCreateUsersWithListInputResponse, - UserDeleteUserData, - UserGetUserByNameData, - UserGetUserByNameResponse, - UserLoginUserData, - UserLoginUserResponse, - UserLogoutUserResponse, - UserUpdateUserData, - UserUpdateUserResponse, + AddPetData, + AddPetResponse, + CreateUserData, + CreateUserResponse, + CreateUsersWithListInputData, + CreateUsersWithListInputResponse, + DeleteOrderData, + DeletePetData, + DeleteUserData, + FindPetsByStatusData, + FindPetsByStatusResponse, + FindPetsByTagsData, + FindPetsByTagsResponse, + GetInventoryResponse, + GetOrderByIdData, + GetOrderByIdResponse, + GetPetByIdData, + GetPetByIdResponse, + GetUserByNameData, + GetUserByNameResponse, + LoginUserData, + LoginUserResponse, + LogoutUserResponse, + PlaceOrderData, + PlaceOrderResponse, + UpdatePetData, + UpdatePetResponse, + UpdatePetWithFormData, + UpdateUserData, + UpdateUserResponse, + UploadFileData, + UploadFileResponse, } from './types.gen'; export class PetService { @@ -48,9 +48,7 @@ export class PetService { * @returns Pet Successful operation * @throws ApiError */ - public static addPet( - data: PetAddPetData, - ): CancelablePromise { + public static addPet(data: AddPetData): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, errors: { @@ -71,8 +69,8 @@ export class PetService { * @throws ApiError */ public static updatePet( - data: PetUpdatePetData, - ): CancelablePromise { + data: UpdatePetData, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, errors: { @@ -95,8 +93,8 @@ export class PetService { * @throws ApiError */ public static findPetsByStatus( - data: PetFindPetsByStatusData = {}, - ): CancelablePromise { + data: FindPetsByStatusData = {}, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid status value', @@ -118,8 +116,8 @@ export class PetService { * @throws ApiError */ public static findPetsByTags( - data: PetFindPetsByTagsData = {}, - ): CancelablePromise { + data: FindPetsByTagsData = {}, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid tag value', @@ -141,8 +139,8 @@ export class PetService { * @throws ApiError */ public static getPetById( - data: PetGetPetByIdData, - ): CancelablePromise { + data: GetPetByIdData, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid ID supplied', @@ -165,7 +163,7 @@ export class PetService { * @throws ApiError */ public static updatePetWithForm( - data: PetUpdatePetWithFormData, + data: UpdatePetWithFormData, ): CancelablePromise { return __request(OpenAPI, { errors: { @@ -190,7 +188,7 @@ export class PetService { * @param data.apiKey * @throws ApiError */ - public static deletePet(data: PetDeletePetData): CancelablePromise { + public static deletePet(data: DeletePetData): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid pet value', @@ -216,8 +214,8 @@ export class PetService { * @throws ApiError */ public static uploadFile( - data: PetUploadFileData, - ): CancelablePromise { + data: UploadFileData, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, mediaType: 'application/octet-stream', @@ -240,7 +238,7 @@ export class StoreService { * @returns number successful operation * @throws ApiError */ - public static getInventory(): CancelablePromise { + public static getInventory(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/store/inventory', @@ -256,8 +254,8 @@ export class StoreService { * @throws ApiError */ public static placeOrder( - data: StorePlaceOrderData = {}, - ): CancelablePromise { + data: PlaceOrderData = {}, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, errors: { @@ -278,8 +276,8 @@ export class StoreService { * @throws ApiError */ public static getOrderById( - data: StoreGetOrderByIdData, - ): CancelablePromise { + data: GetOrderByIdData, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid ID supplied', @@ -300,9 +298,7 @@ export class StoreService { * @param data.orderId ID of the order that needs to be deleted * @throws ApiError */ - public static deleteOrder( - data: StoreDeleteOrderData, - ): CancelablePromise { + public static deleteOrder(data: DeleteOrderData): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid ID supplied', @@ -327,8 +323,8 @@ export class UserService { * @throws ApiError */ public static createUser( - data: UserCreateUserData = {}, - ): CancelablePromise { + data: CreateUserData = {}, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, mediaType: 'application/json', @@ -347,8 +343,8 @@ export class UserService { * @throws ApiError */ public static createUsersWithListInput( - data: UserCreateUsersWithListInputData = {}, - ): CancelablePromise { + data: CreateUsersWithListInputData = {}, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, mediaType: 'application/json', @@ -366,8 +362,8 @@ export class UserService { * @throws ApiError */ public static loginUser( - data: UserLoginUserData = {}, - ): CancelablePromise { + data: LoginUserData = {}, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid username/password supplied', @@ -386,7 +382,7 @@ export class UserService { * @returns unknown successful operation * @throws ApiError */ - public static logoutUser(): CancelablePromise { + public static logoutUser(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/user/logout', @@ -401,8 +397,8 @@ export class UserService { * @throws ApiError */ public static getUserByName( - data: UserGetUserByNameData, - ): CancelablePromise { + data: GetUserByNameData, + ): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid username supplied', @@ -426,8 +422,8 @@ export class UserService { * @throws ApiError */ public static updateUser( - data: UserUpdateUserData, - ): CancelablePromise { + data: UpdateUserData, + ): CancelablePromise { return __request(OpenAPI, { body: data.requestBody, mediaType: 'application/json', @@ -446,7 +442,7 @@ export class UserService { * @param data.username The name that needs to be deleted * @throws ApiError */ - public static deleteUser(data: UserDeleteUserData): CancelablePromise { + public static deleteUser(data: DeleteUserData): CancelablePromise { return __request(OpenAPI, { errors: { 400: 'Invalid username supplied', diff --git a/examples/openapi-ts-fetch/src/client/types.gen.ts b/examples/openapi-ts-fetch/src/client/types.gen.ts index 41dcf806a..fa49f8885 100644 --- a/examples/openapi-ts-fetch/src/client/types.gen.ts +++ b/examples/openapi-ts-fetch/src/client/types.gen.ts @@ -12,11 +12,6 @@ export type Order = { complete?: boolean; }; -/** - * Order Status - */ -export type status = 'placed' | 'approved' | 'delivered'; - export type Customer = { id?: number; username?: string; @@ -72,52 +67,52 @@ export type ApiResponse = { message?: string; }; -export type PetAddPetData = { +export type AddPetData = { /** * Create a new pet in the store */ requestBody: Pet; }; -export type PetAddPetResponse = Pet; +export type AddPetResponse = Pet; -export type PetUpdatePetData = { +export type UpdatePetData = { /** * Update an existent pet in the store */ requestBody: Pet; }; -export type PetUpdatePetResponse = Pet; +export type UpdatePetResponse = Pet; -export type PetFindPetsByStatusData = { +export type FindPetsByStatusData = { /** * Status values that need to be considered for filter */ status?: 'available' | 'pending' | 'sold'; }; -export type PetFindPetsByStatusResponse = Array; +export type FindPetsByStatusResponse = Array; -export type PetFindPetsByTagsData = { +export type FindPetsByTagsData = { /** * Tags to filter by */ tags?: Array; }; -export type PetFindPetsByTagsResponse = Array; +export type FindPetsByTagsResponse = Array; -export type PetGetPetByIdData = { +export type GetPetByIdData = { /** * ID of pet to return */ petId: number; }; -export type PetGetPetByIdResponse = Pet; +export type GetPetByIdResponse = Pet; -export type PetUpdatePetWithFormData = { +export type UpdatePetWithFormData = { /** * Name of pet that needs to be updated */ @@ -132,7 +127,7 @@ export type PetUpdatePetWithFormData = { status?: string; }; -export type PetDeletePetData = { +export type DeletePetData = { apiKey?: string; /** * Pet id to delete @@ -140,7 +135,7 @@ export type PetDeletePetData = { petId: number; }; -export type PetUploadFileData = { +export type UploadFileData = { /** * Additional Metadata */ @@ -152,50 +147,50 @@ export type PetUploadFileData = { requestBody?: Blob | File; }; -export type PetUploadFileResponse = ApiResponse; +export type UploadFileResponse = ApiResponse; -export type StoreGetInventoryResponse = { +export type GetInventoryResponse = { [key: string]: number; }; -export type StorePlaceOrderData = { +export type PlaceOrderData = { requestBody?: Order; }; -export type StorePlaceOrderResponse = Order; +export type PlaceOrderResponse = Order; -export type StoreGetOrderByIdData = { +export type GetOrderByIdData = { /** * ID of order that needs to be fetched */ orderId: number; }; -export type StoreGetOrderByIdResponse = Order; +export type GetOrderByIdResponse = Order; -export type StoreDeleteOrderData = { +export type DeleteOrderData = { /** * ID of the order that needs to be deleted */ orderId: number; }; -export type UserCreateUserData = { +export type CreateUserData = { /** * Created user object */ requestBody?: User; }; -export type UserCreateUserResponse = User; +export type CreateUserResponse = User; -export type UserCreateUsersWithListInputData = { +export type CreateUsersWithListInputData = { requestBody?: Array; }; -export type UserCreateUsersWithListInputResponse = User | unknown; +export type CreateUsersWithListInputResponse = User | unknown; -export type UserLoginUserData = { +export type LoginUserData = { /** * The password for login in clear text */ @@ -206,20 +201,20 @@ export type UserLoginUserData = { username?: string; }; -export type UserLoginUserResponse = string; +export type LoginUserResponse = string; -export type UserLogoutUserResponse = unknown; +export type LogoutUserResponse = unknown; -export type UserGetUserByNameData = { +export type GetUserByNameData = { /** * The name that needs to be fetched. Use user1 for testing. */ username: string; }; -export type UserGetUserByNameResponse = User; +export type GetUserByNameResponse = User; -export type UserUpdateUserData = { +export type UpdateUserData = { /** * Update an existent user in the store */ @@ -230,9 +225,9 @@ export type UserUpdateUserData = { username: string; }; -export type UserUpdateUserResponse = unknown; +export type UpdateUserResponse = unknown; -export type UserDeleteUserData = { +export type DeleteUserData = { /** * The name that needs to be deleted */ diff --git a/packages/openapi-ts/src/openApi/v2/index.ts b/packages/openapi-ts/src/openApi/v2/index.ts index 464fa989e..a1bb2e571 100644 --- a/packages/openapi-ts/src/openApi/v2/index.ts +++ b/packages/openapi-ts/src/openApi/v2/index.ts @@ -20,6 +20,7 @@ export const parse = (openApi: OpenApi): Client => { enumNames: [], models, server, + serviceTypes: [], services, version, }; diff --git a/packages/openapi-ts/src/openApi/v3/index.ts b/packages/openapi-ts/src/openApi/v3/index.ts index 464fa989e..a1bb2e571 100644 --- a/packages/openapi-ts/src/openApi/v3/index.ts +++ b/packages/openapi-ts/src/openApi/v3/index.ts @@ -20,6 +20,7 @@ export const parse = (openApi: OpenApi): Client => { enumNames: [], models, server, + serviceTypes: [], services, version, }; diff --git a/packages/openapi-ts/src/types/client.ts b/packages/openapi-ts/src/types/client.ts index d786e81d8..5acbf7e77 100644 --- a/packages/openapi-ts/src/types/client.ts +++ b/packages/openapi-ts/src/types/client.ts @@ -1,9 +1,12 @@ import { Model, Service } from '../openApi'; export interface Client { + // holds unique enum names to avoid duplicate type exports enumNames: string[]; models: Model[]; server: string; services: Service[]; + // holds unique service type names to avoid duplicate type exports + serviceTypes: string[]; version: string; } diff --git a/packages/openapi-ts/src/utils/postprocess.ts b/packages/openapi-ts/src/utils/postprocess.ts index 919bbccc2..ac24581eb 100644 --- a/packages/openapi-ts/src/utils/postprocess.ts +++ b/packages/openapi-ts/src/utils/postprocess.ts @@ -12,6 +12,7 @@ export function postProcessClient(client: Client): Client { ...client, enumNames: [], models: client.models.map((model) => postProcessModel(model)), + serviceTypes: [], services: client.services.map((service) => postProcessService(service)), }; } diff --git a/packages/openapi-ts/src/utils/write/__tests__/class.spec.ts b/packages/openapi-ts/src/utils/write/__tests__/class.spec.ts index 584cc6fb1..f74e18e55 100644 --- a/packages/openapi-ts/src/utils/write/__tests__/class.spec.ts +++ b/packages/openapi-ts/src/utils/write/__tests__/class.spec.ts @@ -33,6 +33,7 @@ describe('writeClientClass', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: 'v1', }; diff --git a/packages/openapi-ts/src/utils/write/__tests__/client.spec.ts b/packages/openapi-ts/src/utils/write/__tests__/client.spec.ts index a818e9f3d..ad393f578 100644 --- a/packages/openapi-ts/src/utils/write/__tests__/client.spec.ts +++ b/packages/openapi-ts/src/utils/write/__tests__/client.spec.ts @@ -32,6 +32,7 @@ describe('writeClient', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: 'v1', }; diff --git a/packages/openapi-ts/src/utils/write/__tests__/core.spec.ts b/packages/openapi-ts/src/utils/write/__tests__/core.spec.ts index d2dc4486d..62e81478b 100644 --- a/packages/openapi-ts/src/utils/write/__tests__/core.spec.ts +++ b/packages/openapi-ts/src/utils/write/__tests__/core.spec.ts @@ -20,6 +20,7 @@ describe('writeCore', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: '1.0', }; @@ -75,6 +76,7 @@ describe('writeCore', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: '1.0', }; @@ -112,6 +114,7 @@ describe('writeCore', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: '1.0', }; diff --git a/packages/openapi-ts/src/utils/write/__tests__/models.spec.ts b/packages/openapi-ts/src/utils/write/__tests__/models.spec.ts index e0ca8d8aa..0da8204a6 100644 --- a/packages/openapi-ts/src/utils/write/__tests__/models.spec.ts +++ b/packages/openapi-ts/src/utils/write/__tests__/models.spec.ts @@ -52,6 +52,7 @@ describe('processTypes', () => { }, ], server: 'http://localhost:8080', + serviceTypes: [], services: [], version: 'v1', }; diff --git a/packages/openapi-ts/src/utils/write/__tests__/services.spec.ts b/packages/openapi-ts/src/utils/write/__tests__/services.spec.ts index 0426e4c26..4fe60e91f 100644 --- a/packages/openapi-ts/src/utils/write/__tests__/services.spec.ts +++ b/packages/openapi-ts/src/utils/write/__tests__/services.spec.ts @@ -30,6 +30,7 @@ describe('processServices', () => { enumNames: [], models: [], server: 'http://localhost:8080', + serviceTypes: [], services: [ { $refs: [], diff --git a/packages/openapi-ts/src/utils/write/services.ts b/packages/openapi-ts/src/utils/write/services.ts index cf95deeba..266cd21e0 100644 --- a/packages/openapi-ts/src/utils/write/services.ts +++ b/packages/openapi-ts/src/utils/write/services.ts @@ -17,18 +17,10 @@ import { unique } from '../unique'; type OnImport = (importedType: string) => void; export const operationDataTypeName = (operation: Operation) => - `${camelcase(operation.service, { - pascalCase: true, - })}${camelcase(operation.name, { - pascalCase: true, - })}Data`; + `${camelcase(operation.name, { pascalCase: true })}Data`; export const operationResponseTypeName = (operation: Operation) => - `${camelcase(operation.service, { - pascalCase: true, - })}${camelcase(operation.name, { - pascalCase: true, - })}Response`; + `${camelcase(operation.name, { pascalCase: true })}Response`; const toOperationParamType = ( operation: Operation, diff --git a/packages/openapi-ts/src/utils/write/types.ts b/packages/openapi-ts/src/utils/write/types.ts index d8eeacadc..70ba02e78 100644 --- a/packages/openapi-ts/src/utils/write/types.ts +++ b/packages/openapi-ts/src/utils/write/types.ts @@ -137,7 +137,7 @@ const processModel = (client: Client, model: Model, onNode: OnNode) => { } }; -const processServiceTypes = (services: Service[], onNode: OnNode) => { +const processServiceTypes = (client: Client, onNode: OnNode) => { type ResMap = Map; type MethodMap = Map<'req' | 'res', ResMap | OperationParameter[]>; type MethodKey = Service['operations'][number]['method']; @@ -145,7 +145,7 @@ const processServiceTypes = (services: Service[], onNode: OnNode) => { const pathsMap = new Map(); - services.forEach((service) => { + client.services.forEach((service) => { service.operations.forEach((operation) => { const hasReq = operation.parameters.length; const hasRes = operation.results.length; @@ -168,17 +168,18 @@ const processServiceTypes = (services: Service[], onNode: OnNode) => { methodMap.set('req', sortByName([...operation.parameters])); // create type export for operation data - const type = toType({ - ...emptyModel, - export: 'interface', - isRequired: true, - properties: sortByName([...operation.parameters]), - }); - const node = compiler.typedef.alias( - operationDataTypeName(operation), - type, - ); - onNode(node); + const name = operationDataTypeName(operation); + if (!client.serviceTypes.includes(name)) { + client.serviceTypes = [...client.serviceTypes, name]; + const type = toType({ + ...emptyModel, + export: 'interface', + isRequired: true, + properties: sortByName([...operation.parameters]), + }); + const node = compiler.typedef.alias(name, type); + onNode(node); + } } if (hasRes) { @@ -197,26 +198,27 @@ const processServiceTypes = (services: Service[], onNode: OnNode) => { }); // create type export for operation response - let responseProperties: Model[] = []; - operation.results.map((result) => { - if ( - result.code === 'default' || - (result.code >= 200 && result.code < 300) - ) { - responseProperties = [...responseProperties, result]; - } - }); - const type = toType({ - ...emptyModel, - export: 'any-of', - isRequired: true, - properties: responseProperties, - }); - const node = compiler.typedef.alias( - operationResponseTypeName(operation), - type, - ); - onNode(node); + const name = operationResponseTypeName(operation); + if (!client.serviceTypes.includes(name)) { + client.serviceTypes = [...client.serviceTypes, name]; + let responseProperties: Model[] = []; + operation.results.map((result) => { + if ( + result.code === 'default' || + (result.code >= 200 && result.code < 300) + ) { + responseProperties = [...responseProperties, result]; + } + }); + const type = toType({ + ...emptyModel, + export: 'any-of', + isRequired: true, + properties: responseProperties, + }); + const node = compiler.typedef.alias(name, type); + onNode(node); + } } if (hasErr) { @@ -308,7 +310,7 @@ export const processTypes = async ({ } if (files.services && client.services.length) { - processServiceTypes(client.services, (node) => { + processServiceTypes(client, (node) => { files.types?.add(node); }); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap index c4aeaec96..d3b5f31a2 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DescriptionsCallWithDescriptionsData, ParametersCallWithParametersData, ParametersCallWithWeirdParameterNamesData, DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData, NoContentCallWithNoContentResponseResponse, NoContentCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseResponse, ResponseCallWithDuplicateResponsesResponse, ResponseCallWithResponsesResponse, MultipleTags1DummyAResponse, MultipleTags1DummyBResponse, MultipleTags2DummyAResponse, MultipleTags2DummyBResponse, MultipleTags3DummyBResponse, CollectionFormatCollectionFormatData, TypesTypesData, TypesTypesResponse, ComplexComplexTypesData, ComplexComplexTypesResponse, HeaderCallWithResultFromHeaderResponse, ErrorTestErrorCodeData, ErrorTestErrorCodeResponse, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; +import type { CallWithDescriptionsData, CallWithParametersData, CallWithWeirdParameterNamesData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, ComplexTypesData, ComplexTypesResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; export class DefaultService { /** @@ -105,7 +105,7 @@ export class DescriptionsService { * @param data.parameterWithReservedCharacters Testing reserved characters in string: * inline * and ** inline ** should work * @throws ApiError */ - public static callWithDescriptions(data: DescriptionsCallWithDescriptionsData = {}): CancelablePromise { + public static callWithDescriptions(data: CallWithDescriptionsData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/descriptions/', @@ -132,7 +132,7 @@ export class ParametersService { * @param data.parameterPath This is the parameter that goes into the path * @throws ApiError */ - public static callWithParameters(data: ParametersCallWithParametersData): CancelablePromise { + public static callWithParameters(data: CallWithParametersData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -164,7 +164,7 @@ export class ParametersService { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public static callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): CancelablePromise { + public static callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -199,7 +199,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public static callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData): CancelablePromise { + public static callWithDefaultParameters(data: CallWithDefaultParametersData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/defaults', @@ -222,7 +222,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public static callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): CancelablePromise { + public static callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/defaults', @@ -248,7 +248,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public static callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): CancelablePromise { + public static callToTestOrderOfParams(data: CallToTestOrderOfParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/defaults', @@ -315,7 +315,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithNoContentResponse(): CancelablePromise { + public static callWithNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/no-content' @@ -327,7 +327,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -342,7 +342,7 @@ export class ResponseService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -353,7 +353,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public static callWithResponse(): CancelablePromise { + public static callWithResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/response' @@ -364,7 +364,7 @@ export class ResponseService { * @returns ModelWithString Message for 201 response * @throws ApiError */ - public static callWithDuplicateResponses(): CancelablePromise { + public static callWithDuplicateResponses(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/response', @@ -383,7 +383,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public static callWithResponses(): CancelablePromise { + public static callWithResponses(): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/response', @@ -402,7 +402,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -413,7 +413,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -427,7 +427,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -438,7 +438,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -452,7 +452,7 @@ export class MultipleTags3Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -471,7 +471,7 @@ export class CollectionFormatService { * @param data.parameterArrayMulti This is an array parameter that is sent as multi format (multiple parameter instances) * @throws ApiError */ - public static collectionFormat(data: CollectionFormatCollectionFormatData): CancelablePromise { + public static collectionFormat(data: CollectionFormatData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/collectionFormat', @@ -504,7 +504,7 @@ export class TypesService { * @returns unknown Response is a simple object * @throws ApiError */ - public static types(data: TypesTypesData): CancelablePromise { + public static types(data: TypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/types', @@ -533,7 +533,7 @@ export class ComplexService { * @returns ModelWithString Successful response * @throws ApiError */ - public static complexTypes(data: ComplexComplexTypesData): CancelablePromise { + public static complexTypes(data: ComplexTypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/complex', @@ -555,7 +555,7 @@ export class HeaderService { * @returns string Successful response * @throws ApiError */ - public static callWithResultFromHeader(): CancelablePromise { + public static callWithResultFromHeader(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/header', @@ -576,7 +576,7 @@ export class ErrorService { * @returns unknown Custom message: Successful response * @throws ApiError */ - public static testErrorCode(data: ErrorTestErrorCodeData): CancelablePromise { + public static testErrorCode(data: TestErrorCodeData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/error', @@ -601,7 +601,7 @@ export class NonAsciiÆøåÆøÅöôêÊService { * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response * @throws ApiError */ - public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { + public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap index a8cf49cad..2130fc6a6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap @@ -387,7 +387,7 @@ export type ModelWithPattern = { patternWithBacktick?: string; }; -export type DescriptionsCallWithDescriptionsData = { +export type CallWithDescriptionsData = { /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ @@ -417,7 +417,7 @@ export type DescriptionsCallWithDescriptionsData = { parameterWithSlashes?: string; }; -export type ParametersCallWithParametersData = { +export type CallWithParametersData = { /** * This is the parameter that is sent as request body */ @@ -440,7 +440,7 @@ export type ParametersCallWithParametersData = { parameterQuery: string; }; -export type ParametersCallWithWeirdParameterNamesData = { +export type CallWithWeirdParameterNamesData = { /** * This is the parameter with a reserved keyword */ @@ -475,7 +475,7 @@ export type ParametersCallWithWeirdParameterNamesData = { parameterQuery: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -498,7 +498,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString: string; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -521,7 +521,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ @@ -556,33 +556,25 @@ export type DefaultsCallToTestOrderOfParamsData = { parameterStringWithNoDefault: string; }; -export type NoContentCallWithNoContentResponseResponse = void; +export type CallWithNoContentResponseResponse = void; -export type NoContentCallWithResponseAndNoContentResponseResponse = unknown | void; +export type CallWithResponseAndNoContentResponseResponse = unknown | void; -export type ResponseCallWithResponseAndNoContentResponseResponse = unknown | void; +export type CallWithResponseResponse = ModelWithString; -export type ResponseCallWithResponseResponse = ModelWithString; +export type CallWithDuplicateResponsesResponse = ModelWithString; -export type ResponseCallWithDuplicateResponsesResponse = ModelWithString; - -export type ResponseCallWithResponsesResponse = { +export type CallWithResponsesResponse = { readonly '@namespace.string'?: string; readonly '@namespace.integer'?: number; readonly value?: Array; } | ModelThatExtends | ModelThatExtendsExtends | ModelWithString; -export type MultipleTags1DummyAResponse = void; - -export type MultipleTags1DummyBResponse = void; - -export type MultipleTags2DummyAResponse = void; - -export type MultipleTags2DummyBResponse = void; +export type DummyAResponse = void; -export type MultipleTags3DummyBResponse = void; +export type DummyBResponse = void; -export type CollectionFormatCollectionFormatData = { +export type CollectionFormatData = { /** * This is an array parameter that is sent as csv format (comma-separated values) */ @@ -605,7 +597,7 @@ export type CollectionFormatCollectionFormatData = { parameterArrayTsv: Array; }; -export type TypesTypesData = { +export type TypesData = { /** * This is a number parameter */ @@ -642,9 +634,9 @@ export type TypesTypesData = { parameterString: string; }; -export type TypesTypesResponse = number | string | boolean | unknown; +export type TypesResponse = number | string | boolean | unknown; -export type ComplexComplexTypesData = { +export type ComplexTypesData = { /** * Parameter containing object */ @@ -661,27 +653,27 @@ export type ComplexComplexTypesData = { parameterReference: ModelWithString; }; -export type ComplexComplexTypesResponse = Array; +export type ComplexTypesResponse = Array; -export type HeaderCallWithResultFromHeaderResponse = string; +export type CallWithResultFromHeaderResponse = string; -export type ErrorTestErrorCodeData = { +export type TestErrorCodeData = { /** * Status code to return */ status: string; }; -export type ErrorTestErrorCodeResponse = unknown; +export type TestErrorCodeResponse = unknown; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data = { +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { /** * Dummy input param */ nonAsciiParamæøåÆøÅöôêÊ: number; }; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiStringæøåÆØÅöôêÊ字符串; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiStringæøåÆØÅöôêÊ字符串; export type $OpenApiTs = { '/api/v{api-version}/descriptions/': { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap index 86d9c090c..c5d58d315 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DefaultPostServiceWithEmptyTagData, DefaultPostServiceWithEmptyTagResponse, SimpleApiVversionOdataControllerCountResponse, ParametersDeleteFooData, ParametersCallWithParametersData, ParametersCallWithWeirdParameterNamesData, ParametersGetCallWithOptionalParamData, ParametersPostCallWithOptionalParamData, DescriptionsCallWithDescriptionsData, DeprecatedDeprecatedCallData, RequestBodyPostApiRequestBodyData, FormDataPostApiFormDataData, DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData, NoContentCallWithNoContentResponseResponse, NoContentCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseResponse, ResponseCallWithDuplicateResponsesResponse, ResponseCallWithResponsesResponse, MultipleTags1DummyAResponse, MultipleTags1DummyBResponse, MultipleTags2DummyAResponse, MultipleTags2DummyBResponse, MultipleTags3DummyBResponse, CollectionFormatCollectionFormatData, TypesTypesData, TypesTypesResponse, UploadUploadFileData, UploadUploadFileResponse, FileResponseFileResponseData, FileResponseFileResponseResponse, ComplexComplexTypesData, ComplexComplexTypesResponse, ComplexComplexParamsData, ComplexComplexParamsResponse, MultipartMultipartRequestData, MultipartMultipartResponseResponse, HeaderCallWithResultFromHeaderResponse, ErrorTestErrorCodeData, ErrorTestErrorCodeResponse, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; +import type { PostServiceWithEmptyTagData, PostServiceWithEmptyTagResponse, ApiVversionOdataControllerCountResponse, DeleteFooData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; export class DefaultService { /** @@ -22,7 +22,7 @@ export class DefaultService { * @returns ModelWithReadOnlyAndWriteOnly * @throws ApiError */ - public static postServiceWithEmptyTag(data: DefaultPostServiceWithEmptyTagData): CancelablePromise { + public static postServiceWithEmptyTag(data: PostServiceWithEmptyTagData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/no-tag', @@ -38,7 +38,7 @@ export class SimpleService { * @returns Model_From_Zendesk Success * @throws ApiError */ - public static apiVVersionOdataControllerCount(): CancelablePromise { + public static apiVVersionOdataControllerCount(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/simple/$count' @@ -124,7 +124,7 @@ export class ParametersService { * @param data.bar bar in method * @throws ApiError */ - public static deleteFoo(data: ParametersDeleteFooData): CancelablePromise { + public static deleteFoo(data: DeleteFooData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v{api-version}/foo/{foo}/bar/{bar}', @@ -147,7 +147,7 @@ export class ParametersService { * @param data.fooRefEnum * @throws ApiError */ - public static callWithParameters(data: ParametersCallWithParametersData): CancelablePromise { + public static callWithParameters(data: CallWithParametersData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -186,7 +186,7 @@ export class ParametersService { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public static callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): CancelablePromise { + public static callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -219,7 +219,7 @@ export class ParametersService { * @param data.parameter This is an optional parameter * @throws ApiError */ - public static getCallWithOptionalParam(data: ParametersGetCallWithOptionalParamData): CancelablePromise { + public static getCallWithOptionalParam(data: GetCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/parameters/', @@ -237,7 +237,7 @@ export class ParametersService { * @param data.requestBody This is an optional parameter * @throws ApiError */ - public static postCallWithOptionalParam(data: ParametersPostCallWithOptionalParamData): CancelablePromise { + public static postCallWithOptionalParam(data: PostCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/', @@ -265,7 +265,7 @@ export class DescriptionsService { * @param data.parameterWithReservedCharacters Testing reserved characters in string: * inline * and ** inline ** should work * @throws ApiError */ - public static callWithDescriptions(data: DescriptionsCallWithDescriptionsData = {}): CancelablePromise { + public static callWithDescriptions(data: CallWithDescriptionsData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/descriptions/', @@ -289,7 +289,7 @@ export class DeprecatedService { * @param data.parameter This parameter is deprecated * @throws ApiError */ - public static deprecatedCall(data: DeprecatedDeprecatedCallData): CancelablePromise { + public static deprecatedCall(data: DeprecatedCallData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/deprecated', @@ -308,7 +308,7 @@ export class RequestBodyService { * @param data.foo A reusable request body * @throws ApiError */ - public static postApiRequestBody(data: RequestBodyPostApiRequestBodyData = {}): CancelablePromise { + public static postApiRequestBody(data: PostApiRequestBodyData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/requestBody/', @@ -329,7 +329,7 @@ export class FormDataService { * @param data.formData A reusable request body * @throws ApiError */ - public static postApiFormData(data: FormDataPostApiFormDataData = {}): CancelablePromise { + public static postApiFormData(data: PostApiFormDataData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/formData/', @@ -353,7 +353,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public static callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData = {}): CancelablePromise { + public static callWithDefaultParameters(data: CallWithDefaultParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/defaults', @@ -376,7 +376,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public static callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): CancelablePromise { + public static callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/defaults', @@ -402,7 +402,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public static callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): CancelablePromise { + public static callToTestOrderOfParams(data: CallToTestOrderOfParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/defaults', @@ -469,7 +469,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithNoContentResponse(): CancelablePromise { + public static callWithNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/no-content' @@ -481,7 +481,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -496,7 +496,7 @@ export class ResponseService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -507,7 +507,7 @@ export class ResponseService { * @returns ModelWithString * @throws ApiError */ - public static callWithResponse(): CancelablePromise { + public static callWithResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/response' @@ -520,7 +520,7 @@ export class ResponseService { * @returns ModelWithBoolean Message for default response * @throws ApiError */ - public static callWithDuplicateResponses(): CancelablePromise { + public static callWithDuplicateResponses(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/response', @@ -539,7 +539,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public static callWithResponses(): CancelablePromise { + public static callWithResponses(): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/response', @@ -558,7 +558,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -569,7 +569,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -583,7 +583,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -594,7 +594,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -608,7 +608,7 @@ export class MultipleTags3Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -627,7 +627,7 @@ export class CollectionFormatService { * @param data.parameterArrayMulti This is an array parameter that is sent as multi format (multiple parameter instances) * @throws ApiError */ - public static collectionFormat(data: CollectionFormatCollectionFormatData): CancelablePromise { + public static collectionFormat(data: CollectionFormatData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/collectionFormat', @@ -660,7 +660,7 @@ export class TypesService { * @returns unknown Response is a simple object * @throws ApiError */ - public static types(data: TypesTypesData): CancelablePromise { + public static types(data: TypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/types', @@ -688,7 +688,7 @@ export class UploadService { * @returns boolean * @throws ApiError */ - public static uploadFile(data: UploadUploadFileData): CancelablePromise { + public static uploadFile(data: UploadFileData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/upload', @@ -707,7 +707,7 @@ export class FileResponseService { * @returns binary Success * @throws ApiError */ - public static fileResponse(data: FileResponseFileResponseData): CancelablePromise { + public static fileResponse(data: FileResponseData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/file/{id}', @@ -727,7 +727,7 @@ export class ComplexService { * @returns ModelWithString Successful response * @throws ApiError */ - public static complexTypes(data: ComplexComplexTypesData): CancelablePromise { + public static complexTypes(data: ComplexTypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/complex', @@ -749,7 +749,7 @@ export class ComplexService { * @returns ModelWithString Success * @throws ApiError */ - public static complexParams(data: ComplexComplexParamsData): CancelablePromise { + public static complexParams(data: ComplexParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/complex/{id}', @@ -769,7 +769,7 @@ export class MultipartService { * @param data.formData * @throws ApiError */ - public static multipartRequest(data: MultipartMultipartRequestData = {}): CancelablePromise { + public static multipartRequest(data: MultipartRequestData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/multipart', @@ -782,7 +782,7 @@ export class MultipartService { * @returns unknown OK * @throws ApiError */ - public static multipartResponse(): CancelablePromise { + public static multipartResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multipart' @@ -796,7 +796,7 @@ export class HeaderService { * @returns string Successful response * @throws ApiError */ - public static callWithResultFromHeader(): CancelablePromise { + public static callWithResultFromHeader(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/header', @@ -817,7 +817,7 @@ export class ErrorService { * @returns unknown Custom message: Successful response * @throws ApiError */ - public static testErrorCode(data: ErrorTestErrorCodeData): CancelablePromise { + public static testErrorCode(data: TestErrorCodeData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/error', @@ -842,7 +842,7 @@ export class NonAsciiÆøåÆøÅöôêÊService { * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response * @throws ApiError */ - public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { + public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap index 62ddfec84..71b60b9f6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap @@ -820,15 +820,15 @@ export type ParameterSimpleParameter = string; */ export type Parameterx_Foo_Bar = string; -export type DefaultPostServiceWithEmptyTagData = { +export type PostServiceWithEmptyTagData = { requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; }; -export type DefaultPostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; +export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; -export type SimpleApiVversionOdataControllerCountResponse = Model_From_Zendesk; +export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk; -export type ParametersDeleteFooData = { +export type DeleteFooData = { /** * bar in method */ @@ -839,7 +839,7 @@ export type ParametersDeleteFooData = { foo: string; }; -export type ParametersCallWithParametersData = { +export type CallWithParametersData = { fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; /** @@ -868,7 +868,7 @@ export type ParametersCallWithParametersData = { requestBody: ModelWithString | null; }; -export type ParametersCallWithWeirdParameterNamesData = { +export type CallWithWeirdParameterNamesData = { /** * This is the parameter with a reserved keyword */ @@ -907,7 +907,7 @@ export type ParametersCallWithWeirdParameterNamesData = { requestBody: ModelWithString | null; }; -export type ParametersGetCallWithOptionalParamData = { +export type GetCallWithOptionalParamData = { /** * This is an optional parameter */ @@ -918,7 +918,7 @@ export type ParametersGetCallWithOptionalParamData = { requestBody: ModelWithOneOfEnum; }; -export type ParametersPostCallWithOptionalParamData = { +export type PostCallWithOptionalParamData = { /** * This is a required parameter */ @@ -929,7 +929,7 @@ export type ParametersPostCallWithOptionalParamData = { requestBody?: ModelWithString; }; -export type DescriptionsCallWithDescriptionsData = { +export type CallWithDescriptionsData = { /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ @@ -959,7 +959,7 @@ export type DescriptionsCallWithDescriptionsData = { parameterWithSlashes?: unknown; }; -export type DeprecatedDeprecatedCallData = { +export type DeprecatedCallData = { /** * This parameter is deprecated * @deprecated @@ -967,7 +967,7 @@ export type DeprecatedDeprecatedCallData = { parameter: DeprecatedModel | null; }; -export type RequestBodyPostApiRequestBodyData = { +export type PostApiRequestBodyData = { /** * A reusable request body */ @@ -978,7 +978,7 @@ export type RequestBodyPostApiRequestBodyData = { parameter?: string; }; -export type FormDataPostApiFormDataData = { +export type PostApiFormDataData = { /** * A reusable request body */ @@ -989,7 +989,7 @@ export type FormDataPostApiFormDataData = { parameter?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -1012,7 +1012,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString?: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -1035,7 +1035,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ @@ -1070,33 +1070,25 @@ export type DefaultsCallToTestOrderOfParamsData = { parameterStringWithNoDefault: string; }; -export type NoContentCallWithNoContentResponseResponse = void; +export type CallWithNoContentResponseResponse = void; -export type NoContentCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseAndNoContentResponseResponse = number | void; -export type ResponseCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseResponse = ModelWithString; -export type ResponseCallWithResponseResponse = ModelWithString; +export type CallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; -export type ResponseCallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; - -export type ResponseCallWithResponsesResponse = { +export type CallWithResponsesResponse = { readonly '@namespace.string'?: string; readonly '@namespace.integer'?: number; readonly value?: Array; } | ModelThatExtends | ModelThatExtendsExtends | ModelWithString; -export type MultipleTags1DummyAResponse = void; - -export type MultipleTags1DummyBResponse = void; - -export type MultipleTags2DummyAResponse = void; - -export type MultipleTags2DummyBResponse = void; +export type DummyAResponse = void; -export type MultipleTags3DummyBResponse = void; +export type DummyBResponse = void; -export type CollectionFormatCollectionFormatData = { +export type CollectionFormatData = { /** * This is an array parameter that is sent as csv format (comma-separated values) */ @@ -1119,7 +1111,7 @@ export type CollectionFormatCollectionFormatData = { parameterArrayTsv: Array<(string)> | null; }; -export type TypesTypesData = { +export type TypesData = { /** * This is a number parameter */ @@ -1158,26 +1150,26 @@ export type TypesTypesData = { parameterString: string | null; }; -export type TypesTypesResponse = number | string | boolean | { +export type TypesResponse = number | string | boolean | { [key: string]: unknown; }; -export type UploadUploadFileData = { +export type UploadFileData = { /** * Supply a file reference for upload */ file: (Blob | File); }; -export type UploadUploadFileResponse = boolean; +export type UploadFileResponse = boolean; -export type FileResponseFileResponseData = { +export type FileResponseData = { id: string; }; -export type FileResponseFileResponseResponse = (Blob | File); +export type FileResponseResponse = (Blob | File); -export type ComplexComplexTypesData = { +export type ComplexTypesData = { /** * Parameter containing object */ @@ -1194,9 +1186,9 @@ export type ComplexComplexTypesData = { parameterReference: ModelWithString; }; -export type ComplexComplexTypesResponse = Array; +export type ComplexTypesResponse = Array; -export type ComplexComplexParamsData = { +export type ComplexParamsData = { id: number; requestBody?: { readonly key: string | null; @@ -1213,16 +1205,16 @@ export type ComplexComplexParamsData = { }; }; -export type ComplexComplexParamsResponse = ModelWithString; +export type ComplexParamsResponse = ModelWithString; -export type MultipartMultipartRequestData = { +export type MultipartRequestData = { formData?: { content?: (Blob | File); data?: ModelWithString | null; }; }; -export type MultipartMultipartResponseResponse = { +export type MultipartResponseResponse = { file?: (Blob | File); metadata?: { foo?: string; @@ -1230,25 +1222,25 @@ export type MultipartMultipartResponseResponse = { }; }; -export type HeaderCallWithResultFromHeaderResponse = string; +export type CallWithResultFromHeaderResponse = string; -export type ErrorTestErrorCodeData = { +export type TestErrorCodeData = { /** * Status code to return */ status: number; }; -export type ErrorTestErrorCodeResponse = unknown; +export type TestErrorCodeResponse = unknown; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data = { +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { /** * Dummy input param */ nonAsciiParamæøåÆøÅöôêÊ: number; }; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response = Array; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = Array; export type $OpenApiTs = { '/api/v{api-version}/no-tag': { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap index bf92a7bb5..3a90d0426 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap @@ -5,7 +5,7 @@ import { HttpClient } from '@angular/common/http'; import type { Observable } from 'rxjs'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DefaultPostServiceWithEmptyTagData, DefaultPostServiceWithEmptyTagResponse, SimpleApiVversionOdataControllerCountResponse, ParametersDeleteFooData, ParametersCallWithParametersData, ParametersCallWithWeirdParameterNamesData, ParametersGetCallWithOptionalParamData, ParametersPostCallWithOptionalParamData, DescriptionsCallWithDescriptionsData, DeprecatedDeprecatedCallData, RequestBodyPostApiRequestBodyData, FormDataPostApiFormDataData, DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData, NoContentCallWithNoContentResponseResponse, NoContentCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseResponse, ResponseCallWithDuplicateResponsesResponse, ResponseCallWithResponsesResponse, MultipleTags1DummyAResponse, MultipleTags1DummyBResponse, MultipleTags2DummyAResponse, MultipleTags2DummyBResponse, MultipleTags3DummyBResponse, CollectionFormatCollectionFormatData, TypesTypesData, TypesTypesResponse, UploadUploadFileData, UploadUploadFileResponse, FileResponseFileResponseData, FileResponseFileResponseResponse, ComplexComplexTypesData, ComplexComplexTypesResponse, ComplexComplexParamsData, ComplexComplexParamsResponse, MultipartMultipartRequestData, MultipartMultipartResponseResponse, HeaderCallWithResultFromHeaderResponse, ErrorTestErrorCodeData, ErrorTestErrorCodeResponse, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; +import type { PostServiceWithEmptyTagData, PostServiceWithEmptyTagResponse, ApiVversionOdataControllerCountResponse, DeleteFooData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; @Injectable({ providedIn: 'root' @@ -29,7 +29,7 @@ export class DefaultService { * @returns ModelWithReadOnlyAndWriteOnly * @throws ApiError */ - public postServiceWithEmptyTag(data: DefaultPostServiceWithEmptyTagData): Observable { + public postServiceWithEmptyTag(data: PostServiceWithEmptyTagData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/no-tag', @@ -50,7 +50,7 @@ export class SimpleService { * @returns Model_From_Zendesk Success * @throws ApiError */ - public apiVVersionOdataControllerCount(): Observable { + public apiVVersionOdataControllerCount(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/simple/$count' @@ -141,7 +141,7 @@ export class ParametersService { * @param data.bar bar in method * @throws ApiError */ - public deleteFoo(data: ParametersDeleteFooData): Observable { + public deleteFoo(data: DeleteFooData): Observable { return __request(OpenAPI, this.http, { method: 'DELETE', url: '/api/v{api-version}/foo/{foo}/bar/{bar}', @@ -164,7 +164,7 @@ export class ParametersService { * @param data.fooRefEnum * @throws ApiError */ - public callWithParameters(data: ParametersCallWithParametersData): Observable { + public callWithParameters(data: CallWithParametersData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -203,7 +203,7 @@ export class ParametersService { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): Observable { + public callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -236,7 +236,7 @@ export class ParametersService { * @param data.parameter This is an optional parameter * @throws ApiError */ - public getCallWithOptionalParam(data: ParametersGetCallWithOptionalParamData): Observable { + public getCallWithOptionalParam(data: GetCallWithOptionalParamData): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/parameters/', @@ -254,7 +254,7 @@ export class ParametersService { * @param data.requestBody This is an optional parameter * @throws ApiError */ - public postCallWithOptionalParam(data: ParametersPostCallWithOptionalParamData): Observable { + public postCallWithOptionalParam(data: PostCallWithOptionalParamData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/parameters/', @@ -287,7 +287,7 @@ export class DescriptionsService { * @param data.parameterWithReservedCharacters Testing reserved characters in string: * inline * and ** inline ** should work * @throws ApiError */ - public callWithDescriptions(data: DescriptionsCallWithDescriptionsData = {}): Observable { + public callWithDescriptions(data: CallWithDescriptionsData = {}): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/descriptions/', @@ -316,7 +316,7 @@ export class DeprecatedService { * @param data.parameter This parameter is deprecated * @throws ApiError */ - public deprecatedCall(data: DeprecatedDeprecatedCallData): Observable { + public deprecatedCall(data: DeprecatedCallData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/parameters/deprecated', @@ -340,7 +340,7 @@ export class RequestBodyService { * @param data.foo A reusable request body * @throws ApiError */ - public postApiRequestBody(data: RequestBodyPostApiRequestBodyData = {}): Observable { + public postApiRequestBody(data: PostApiRequestBodyData = {}): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/requestBody/', @@ -366,7 +366,7 @@ export class FormDataService { * @param data.formData A reusable request body * @throws ApiError */ - public postApiFormData(data: FormDataPostApiFormDataData = {}): Observable { + public postApiFormData(data: PostApiFormDataData = {}): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/formData/', @@ -395,7 +395,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData = {}): Observable { + public callWithDefaultParameters(data: CallWithDefaultParametersData = {}): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/defaults', @@ -418,7 +418,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): Observable { + public callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/defaults', @@ -444,7 +444,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): Observable { + public callToTestOrderOfParams(data: CallToTestOrderOfParamsData): Observable { return __request(OpenAPI, this.http, { method: 'PUT', url: '/api/v{api-version}/defaults', @@ -521,7 +521,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public callWithNoContentResponse(): Observable { + public callWithNoContentResponse(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/no-content' @@ -533,7 +533,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public callWithResponseAndNoContentResponse(): Observable { + public callWithResponseAndNoContentResponse(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -553,7 +553,7 @@ export class ResponseService { * @returns void Success * @throws ApiError */ - public callWithResponseAndNoContentResponse(): Observable { + public callWithResponseAndNoContentResponse(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -564,7 +564,7 @@ export class ResponseService { * @returns ModelWithString * @throws ApiError */ - public callWithResponse(): Observable { + public callWithResponse(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/response' @@ -577,7 +577,7 @@ export class ResponseService { * @returns ModelWithBoolean Message for default response * @throws ApiError */ - public callWithDuplicateResponses(): Observable { + public callWithDuplicateResponses(): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/response', @@ -596,7 +596,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public callWithResponses(): Observable { + public callWithResponses(): Observable { return __request(OpenAPI, this.http, { method: 'PUT', url: '/api/v{api-version}/response', @@ -620,7 +620,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public dummyA(): Observable { + public dummyA(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -631,7 +631,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public dummyB(): Observable { + public dummyB(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -650,7 +650,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public dummyA(): Observable { + public dummyA(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -661,7 +661,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public dummyB(): Observable { + public dummyB(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -680,7 +680,7 @@ export class MultipleTags3Service { * @returns void Success * @throws ApiError */ - public dummyB(): Observable { + public dummyB(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -704,7 +704,7 @@ export class CollectionFormatService { * @param data.parameterArrayMulti This is an array parameter that is sent as multi format (multiple parameter instances) * @throws ApiError */ - public collectionFormat(data: CollectionFormatCollectionFormatData): Observable { + public collectionFormat(data: CollectionFormatData): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/collectionFormat', @@ -742,7 +742,7 @@ export class TypesService { * @returns unknown Response is a simple object * @throws ApiError */ - public types(data: TypesTypesData): Observable { + public types(data: TypesData): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/types', @@ -775,7 +775,7 @@ export class UploadService { * @returns boolean * @throws ApiError */ - public uploadFile(data: UploadUploadFileData): Observable { + public uploadFile(data: UploadFileData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/upload', @@ -799,7 +799,7 @@ export class FileResponseService { * @returns binary Success * @throws ApiError */ - public fileResponse(data: FileResponseFileResponseData): Observable { + public fileResponse(data: FileResponseData): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/file/{id}', @@ -824,7 +824,7 @@ export class ComplexService { * @returns ModelWithString Successful response * @throws ApiError */ - public complexTypes(data: ComplexComplexTypesData): Observable { + public complexTypes(data: ComplexTypesData): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/complex', @@ -846,7 +846,7 @@ export class ComplexService { * @returns ModelWithString Success * @throws ApiError */ - public complexParams(data: ComplexComplexParamsData): Observable { + public complexParams(data: ComplexParamsData): Observable { return __request(OpenAPI, this.http, { method: 'PUT', url: '/api/v{api-version}/complex/{id}', @@ -871,7 +871,7 @@ export class MultipartService { * @param data.formData * @throws ApiError */ - public multipartRequest(data: MultipartMultipartRequestData = {}): Observable { + public multipartRequest(data: MultipartRequestData = {}): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/multipart', @@ -884,7 +884,7 @@ export class MultipartService { * @returns unknown OK * @throws ApiError */ - public multipartResponse(): Observable { + public multipartResponse(): Observable { return __request(OpenAPI, this.http, { method: 'GET', url: '/api/v{api-version}/multipart' @@ -903,7 +903,7 @@ export class HeaderService { * @returns string Successful response * @throws ApiError */ - public callWithResultFromHeader(): Observable { + public callWithResultFromHeader(): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/header', @@ -929,7 +929,7 @@ export class ErrorService { * @returns unknown Custom message: Successful response * @throws ApiError */ - public testErrorCode(data: ErrorTestErrorCodeData): Observable { + public testErrorCode(data: TestErrorCodeData): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/error', @@ -959,7 +959,7 @@ export class NonAsciiÆøåÆøÅöôêÊService { * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response * @throws ApiError */ - public nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data): Observable { + public nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiæøåÆøÅöôêÊ字符串Data): Observable { return __request(OpenAPI, this.http, { method: 'POST', url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap index 62ddfec84..71b60b9f6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap @@ -820,15 +820,15 @@ export type ParameterSimpleParameter = string; */ export type Parameterx_Foo_Bar = string; -export type DefaultPostServiceWithEmptyTagData = { +export type PostServiceWithEmptyTagData = { requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; }; -export type DefaultPostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; +export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; -export type SimpleApiVversionOdataControllerCountResponse = Model_From_Zendesk; +export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk; -export type ParametersDeleteFooData = { +export type DeleteFooData = { /** * bar in method */ @@ -839,7 +839,7 @@ export type ParametersDeleteFooData = { foo: string; }; -export type ParametersCallWithParametersData = { +export type CallWithParametersData = { fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; /** @@ -868,7 +868,7 @@ export type ParametersCallWithParametersData = { requestBody: ModelWithString | null; }; -export type ParametersCallWithWeirdParameterNamesData = { +export type CallWithWeirdParameterNamesData = { /** * This is the parameter with a reserved keyword */ @@ -907,7 +907,7 @@ export type ParametersCallWithWeirdParameterNamesData = { requestBody: ModelWithString | null; }; -export type ParametersGetCallWithOptionalParamData = { +export type GetCallWithOptionalParamData = { /** * This is an optional parameter */ @@ -918,7 +918,7 @@ export type ParametersGetCallWithOptionalParamData = { requestBody: ModelWithOneOfEnum; }; -export type ParametersPostCallWithOptionalParamData = { +export type PostCallWithOptionalParamData = { /** * This is a required parameter */ @@ -929,7 +929,7 @@ export type ParametersPostCallWithOptionalParamData = { requestBody?: ModelWithString; }; -export type DescriptionsCallWithDescriptionsData = { +export type CallWithDescriptionsData = { /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ @@ -959,7 +959,7 @@ export type DescriptionsCallWithDescriptionsData = { parameterWithSlashes?: unknown; }; -export type DeprecatedDeprecatedCallData = { +export type DeprecatedCallData = { /** * This parameter is deprecated * @deprecated @@ -967,7 +967,7 @@ export type DeprecatedDeprecatedCallData = { parameter: DeprecatedModel | null; }; -export type RequestBodyPostApiRequestBodyData = { +export type PostApiRequestBodyData = { /** * A reusable request body */ @@ -978,7 +978,7 @@ export type RequestBodyPostApiRequestBodyData = { parameter?: string; }; -export type FormDataPostApiFormDataData = { +export type PostApiFormDataData = { /** * A reusable request body */ @@ -989,7 +989,7 @@ export type FormDataPostApiFormDataData = { parameter?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -1012,7 +1012,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString?: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -1035,7 +1035,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ @@ -1070,33 +1070,25 @@ export type DefaultsCallToTestOrderOfParamsData = { parameterStringWithNoDefault: string; }; -export type NoContentCallWithNoContentResponseResponse = void; +export type CallWithNoContentResponseResponse = void; -export type NoContentCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseAndNoContentResponseResponse = number | void; -export type ResponseCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseResponse = ModelWithString; -export type ResponseCallWithResponseResponse = ModelWithString; +export type CallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; -export type ResponseCallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; - -export type ResponseCallWithResponsesResponse = { +export type CallWithResponsesResponse = { readonly '@namespace.string'?: string; readonly '@namespace.integer'?: number; readonly value?: Array; } | ModelThatExtends | ModelThatExtendsExtends | ModelWithString; -export type MultipleTags1DummyAResponse = void; - -export type MultipleTags1DummyBResponse = void; - -export type MultipleTags2DummyAResponse = void; - -export type MultipleTags2DummyBResponse = void; +export type DummyAResponse = void; -export type MultipleTags3DummyBResponse = void; +export type DummyBResponse = void; -export type CollectionFormatCollectionFormatData = { +export type CollectionFormatData = { /** * This is an array parameter that is sent as csv format (comma-separated values) */ @@ -1119,7 +1111,7 @@ export type CollectionFormatCollectionFormatData = { parameterArrayTsv: Array<(string)> | null; }; -export type TypesTypesData = { +export type TypesData = { /** * This is a number parameter */ @@ -1158,26 +1150,26 @@ export type TypesTypesData = { parameterString: string | null; }; -export type TypesTypesResponse = number | string | boolean | { +export type TypesResponse = number | string | boolean | { [key: string]: unknown; }; -export type UploadUploadFileData = { +export type UploadFileData = { /** * Supply a file reference for upload */ file: (Blob | File); }; -export type UploadUploadFileResponse = boolean; +export type UploadFileResponse = boolean; -export type FileResponseFileResponseData = { +export type FileResponseData = { id: string; }; -export type FileResponseFileResponseResponse = (Blob | File); +export type FileResponseResponse = (Blob | File); -export type ComplexComplexTypesData = { +export type ComplexTypesData = { /** * Parameter containing object */ @@ -1194,9 +1186,9 @@ export type ComplexComplexTypesData = { parameterReference: ModelWithString; }; -export type ComplexComplexTypesResponse = Array; +export type ComplexTypesResponse = Array; -export type ComplexComplexParamsData = { +export type ComplexParamsData = { id: number; requestBody?: { readonly key: string | null; @@ -1213,16 +1205,16 @@ export type ComplexComplexParamsData = { }; }; -export type ComplexComplexParamsResponse = ModelWithString; +export type ComplexParamsResponse = ModelWithString; -export type MultipartMultipartRequestData = { +export type MultipartRequestData = { formData?: { content?: (Blob | File); data?: ModelWithString | null; }; }; -export type MultipartMultipartResponseResponse = { +export type MultipartResponseResponse = { file?: (Blob | File); metadata?: { foo?: string; @@ -1230,25 +1222,25 @@ export type MultipartMultipartResponseResponse = { }; }; -export type HeaderCallWithResultFromHeaderResponse = string; +export type CallWithResultFromHeaderResponse = string; -export type ErrorTestErrorCodeData = { +export type TestErrorCodeData = { /** * Status code to return */ status: number; }; -export type ErrorTestErrorCodeResponse = unknown; +export type TestErrorCodeResponse = unknown; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data = { +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { /** * Dummy input param */ nonAsciiParamæøåÆøÅöôêÊ: number; }; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response = Array; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = Array; export type $OpenApiTs = { '/api/v{api-version}/no-tag': { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap index 5477bc534..fdb12aedd 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap @@ -2,7 +2,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import type { BaseHttpRequest } from './core/BaseHttpRequest'; -import type { DefaultPostServiceWithEmptyTagData, DefaultPostServiceWithEmptyTagResponse, SimpleApiVversionOdataControllerCountResponse, ParametersDeleteFooData, ParametersCallWithParametersData, ParametersCallWithWeirdParameterNamesData, ParametersGetCallWithOptionalParamData, ParametersPostCallWithOptionalParamData, DescriptionsCallWithDescriptionsData, DeprecatedDeprecatedCallData, RequestBodyPostApiRequestBodyData, FormDataPostApiFormDataData, DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData, NoContentCallWithNoContentResponseResponse, NoContentCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseResponse, ResponseCallWithDuplicateResponsesResponse, ResponseCallWithResponsesResponse, MultipleTags1DummyAResponse, MultipleTags1DummyBResponse, MultipleTags2DummyAResponse, MultipleTags2DummyBResponse, MultipleTags3DummyBResponse, CollectionFormatCollectionFormatData, TypesTypesData, TypesTypesResponse, UploadUploadFileData, UploadUploadFileResponse, FileResponseFileResponseData, FileResponseFileResponseResponse, ComplexComplexTypesData, ComplexComplexTypesResponse, ComplexComplexParamsData, ComplexComplexParamsResponse, MultipartMultipartRequestData, MultipartMultipartResponseResponse, HeaderCallWithResultFromHeaderResponse, ErrorTestErrorCodeData, ErrorTestErrorCodeResponse, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; +import type { PostServiceWithEmptyTagData, PostServiceWithEmptyTagResponse, ApiVversionOdataControllerCountResponse, DeleteFooData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; export class DefaultService { constructor(public readonly httpRequest: BaseHttpRequest) { } @@ -23,7 +23,7 @@ export class DefaultService { * @returns ModelWithReadOnlyAndWriteOnly * @throws ApiError */ - public postServiceWithEmptyTag(data: DefaultPostServiceWithEmptyTagData): CancelablePromise { + public postServiceWithEmptyTag(data: PostServiceWithEmptyTagData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/no-tag', @@ -41,7 +41,7 @@ export class SimpleService { * @returns Model_From_Zendesk Success * @throws ApiError */ - public apiVVersionOdataControllerCount(): CancelablePromise { + public apiVVersionOdataControllerCount(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/simple/$count' @@ -129,7 +129,7 @@ export class ParametersService { * @param data.bar bar in method * @throws ApiError */ - public deleteFoo(data: ParametersDeleteFooData): CancelablePromise { + public deleteFoo(data: DeleteFooData): CancelablePromise { return this.httpRequest.request({ method: 'DELETE', url: '/api/v{api-version}/foo/{foo}/bar/{bar}', @@ -152,7 +152,7 @@ export class ParametersService { * @param data.fooRefEnum * @throws ApiError */ - public callWithParameters(data: ParametersCallWithParametersData): CancelablePromise { + public callWithParameters(data: CallWithParametersData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -191,7 +191,7 @@ export class ParametersService { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): CancelablePromise { + public callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -224,7 +224,7 @@ export class ParametersService { * @param data.parameter This is an optional parameter * @throws ApiError */ - public getCallWithOptionalParam(data: ParametersGetCallWithOptionalParamData): CancelablePromise { + public getCallWithOptionalParam(data: GetCallWithOptionalParamData): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/parameters/', @@ -242,7 +242,7 @@ export class ParametersService { * @param data.requestBody This is an optional parameter * @throws ApiError */ - public postCallWithOptionalParam(data: ParametersPostCallWithOptionalParamData): CancelablePromise { + public postCallWithOptionalParam(data: PostCallWithOptionalParamData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/parameters/', @@ -272,7 +272,7 @@ export class DescriptionsService { * @param data.parameterWithReservedCharacters Testing reserved characters in string: * inline * and ** inline ** should work * @throws ApiError */ - public callWithDescriptions(data: DescriptionsCallWithDescriptionsData = {}): CancelablePromise { + public callWithDescriptions(data: CallWithDescriptionsData = {}): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/descriptions/', @@ -298,7 +298,7 @@ export class DeprecatedService { * @param data.parameter This parameter is deprecated * @throws ApiError */ - public deprecatedCall(data: DeprecatedDeprecatedCallData): CancelablePromise { + public deprecatedCall(data: DeprecatedCallData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/parameters/deprecated', @@ -319,7 +319,7 @@ export class RequestBodyService { * @param data.foo A reusable request body * @throws ApiError */ - public postApiRequestBody(data: RequestBodyPostApiRequestBodyData = {}): CancelablePromise { + public postApiRequestBody(data: PostApiRequestBodyData = {}): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/requestBody/', @@ -342,7 +342,7 @@ export class FormDataService { * @param data.formData A reusable request body * @throws ApiError */ - public postApiFormData(data: FormDataPostApiFormDataData = {}): CancelablePromise { + public postApiFormData(data: PostApiFormDataData = {}): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/formData/', @@ -368,7 +368,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData = {}): CancelablePromise { + public callWithDefaultParameters(data: CallWithDefaultParametersData = {}): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/defaults', @@ -391,7 +391,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): CancelablePromise { + public callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/defaults', @@ -417,7 +417,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): CancelablePromise { + public callToTestOrderOfParams(data: CallToTestOrderOfParamsData): CancelablePromise { return this.httpRequest.request({ method: 'PUT', url: '/api/v{api-version}/defaults', @@ -488,7 +488,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public callWithNoContentResponse(): CancelablePromise { + public callWithNoContentResponse(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/no-content' @@ -500,7 +500,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public callWithResponseAndNoContentResponse(): CancelablePromise { + public callWithResponseAndNoContentResponse(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -517,7 +517,7 @@ export class ResponseService { * @returns void Success * @throws ApiError */ - public callWithResponseAndNoContentResponse(): CancelablePromise { + public callWithResponseAndNoContentResponse(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -528,7 +528,7 @@ export class ResponseService { * @returns ModelWithString * @throws ApiError */ - public callWithResponse(): CancelablePromise { + public callWithResponse(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/response' @@ -541,7 +541,7 @@ export class ResponseService { * @returns ModelWithBoolean Message for default response * @throws ApiError */ - public callWithDuplicateResponses(): CancelablePromise { + public callWithDuplicateResponses(): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/response', @@ -560,7 +560,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public callWithResponses(): CancelablePromise { + public callWithResponses(): CancelablePromise { return this.httpRequest.request({ method: 'PUT', url: '/api/v{api-version}/response', @@ -581,7 +581,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public dummyA(): CancelablePromise { + public dummyA(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -592,7 +592,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public dummyB(): CancelablePromise { + public dummyB(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -608,7 +608,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public dummyA(): CancelablePromise { + public dummyA(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -619,7 +619,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public dummyB(): CancelablePromise { + public dummyB(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -635,7 +635,7 @@ export class MultipleTags3Service { * @returns void Success * @throws ApiError */ - public dummyB(): CancelablePromise { + public dummyB(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -656,7 +656,7 @@ export class CollectionFormatService { * @param data.parameterArrayMulti This is an array parameter that is sent as multi format (multiple parameter instances) * @throws ApiError */ - public collectionFormat(data: CollectionFormatCollectionFormatData): CancelablePromise { + public collectionFormat(data: CollectionFormatData): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/collectionFormat', @@ -691,7 +691,7 @@ export class TypesService { * @returns unknown Response is a simple object * @throws ApiError */ - public types(data: TypesTypesData): CancelablePromise { + public types(data: TypesData): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/types', @@ -721,7 +721,7 @@ export class UploadService { * @returns boolean * @throws ApiError */ - public uploadFile(data: UploadUploadFileData): CancelablePromise { + public uploadFile(data: UploadFileData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/upload', @@ -742,7 +742,7 @@ export class FileResponseService { * @returns binary Success * @throws ApiError */ - public fileResponse(data: FileResponseFileResponseData): CancelablePromise { + public fileResponse(data: FileResponseData): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/file/{id}', @@ -764,7 +764,7 @@ export class ComplexService { * @returns ModelWithString Successful response * @throws ApiError */ - public complexTypes(data: ComplexComplexTypesData): CancelablePromise { + public complexTypes(data: ComplexTypesData): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/complex', @@ -786,7 +786,7 @@ export class ComplexService { * @returns ModelWithString Success * @throws ApiError */ - public complexParams(data: ComplexComplexParamsData): CancelablePromise { + public complexParams(data: ComplexParamsData): CancelablePromise { return this.httpRequest.request({ method: 'PUT', url: '/api/v{api-version}/complex/{id}', @@ -808,7 +808,7 @@ export class MultipartService { * @param data.formData * @throws ApiError */ - public multipartRequest(data: MultipartMultipartRequestData = {}): CancelablePromise { + public multipartRequest(data: MultipartRequestData = {}): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/multipart', @@ -821,7 +821,7 @@ export class MultipartService { * @returns unknown OK * @throws ApiError */ - public multipartResponse(): CancelablePromise { + public multipartResponse(): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/api/v{api-version}/multipart' @@ -837,7 +837,7 @@ export class HeaderService { * @returns string Successful response * @throws ApiError */ - public callWithResultFromHeader(): CancelablePromise { + public callWithResultFromHeader(): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/header', @@ -860,7 +860,7 @@ export class ErrorService { * @returns unknown Custom message: Successful response * @throws ApiError */ - public testErrorCode(data: ErrorTestErrorCodeData): CancelablePromise { + public testErrorCode(data: TestErrorCodeData): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/error', @@ -887,7 +887,7 @@ export class NonAsciiÆøåÆøÅöôêÊService { * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response * @throws ApiError */ - public nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { + public nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap index 016357520..08f5d2b76 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap @@ -820,15 +820,15 @@ export type ParameterSimpleParameter = string; */ export type Parameterx_Foo_Bar = string; -export type DefaultPostServiceWithEmptyTagData = { +export type PostServiceWithEmptyTagData = { requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; }; -export type DefaultPostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; +export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; -export type SimpleApiVversionOdataControllerCountResponse = Model_From_Zendesk; +export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk; -export type ParametersDeleteFooData = { +export type DeleteFooData = { /** * bar in method */ @@ -839,7 +839,7 @@ export type ParametersDeleteFooData = { foo: string; }; -export type ParametersCallWithParametersData = { +export type CallWithParametersData = { fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; /** @@ -868,7 +868,7 @@ export type ParametersCallWithParametersData = { requestBody: ModelWithString | null; }; -export type ParametersCallWithWeirdParameterNamesData = { +export type CallWithWeirdParameterNamesData = { /** * This is the parameter with a reserved keyword */ @@ -907,7 +907,7 @@ export type ParametersCallWithWeirdParameterNamesData = { requestBody: ModelWithString | null; }; -export type ParametersGetCallWithOptionalParamData = { +export type GetCallWithOptionalParamData = { /** * This is an optional parameter */ @@ -918,7 +918,7 @@ export type ParametersGetCallWithOptionalParamData = { requestBody: ModelWithOneOfEnum; }; -export type ParametersPostCallWithOptionalParamData = { +export type PostCallWithOptionalParamData = { /** * This is a required parameter */ @@ -929,7 +929,7 @@ export type ParametersPostCallWithOptionalParamData = { requestBody?: ModelWithString; }; -export type DescriptionsCallWithDescriptionsData = { +export type CallWithDescriptionsData = { /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ @@ -959,7 +959,7 @@ export type DescriptionsCallWithDescriptionsData = { parameterWithSlashes?: unknown; }; -export type DeprecatedDeprecatedCallData = { +export type DeprecatedCallData = { /** * This parameter is deprecated * @deprecated @@ -967,7 +967,7 @@ export type DeprecatedDeprecatedCallData = { parameter: DeprecatedModel | null; }; -export type RequestBodyPostApiRequestBodyData = { +export type PostApiRequestBodyData = { /** * A reusable request body */ @@ -978,7 +978,7 @@ export type RequestBodyPostApiRequestBodyData = { parameter?: string; }; -export type FormDataPostApiFormDataData = { +export type PostApiFormDataData = { /** * A reusable request body */ @@ -989,7 +989,7 @@ export type FormDataPostApiFormDataData = { parameter?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -1012,7 +1012,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString?: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -1035,7 +1035,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ @@ -1070,33 +1070,25 @@ export type DefaultsCallToTestOrderOfParamsData = { parameterStringWithNoDefault: string; }; -export type NoContentCallWithNoContentResponseResponse = void; +export type CallWithNoContentResponseResponse = void; -export type NoContentCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseAndNoContentResponseResponse = number | void; -export type ResponseCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseResponse = ModelWithString; -export type ResponseCallWithResponseResponse = ModelWithString; +export type CallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; -export type ResponseCallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; - -export type ResponseCallWithResponsesResponse = { +export type CallWithResponsesResponse = { readonly '@namespace.string'?: string; readonly '@namespace.integer'?: number; readonly value?: Array; } | ModelThatExtends | ModelThatExtendsExtends | ModelWithString; -export type MultipleTags1DummyAResponse = void; - -export type MultipleTags1DummyBResponse = void; - -export type MultipleTags2DummyAResponse = void; - -export type MultipleTags2DummyBResponse = void; +export type DummyAResponse = void; -export type MultipleTags3DummyBResponse = void; +export type DummyBResponse = void; -export type CollectionFormatCollectionFormatData = { +export type CollectionFormatData = { /** * This is an array parameter that is sent as csv format (comma-separated values) */ @@ -1119,7 +1111,7 @@ export type CollectionFormatCollectionFormatData = { parameterArrayTsv: Array<(string)> | null; }; -export type TypesTypesData = { +export type TypesData = { /** * This is a number parameter */ @@ -1158,26 +1150,26 @@ export type TypesTypesData = { parameterString: string | null; }; -export type TypesTypesResponse = number | string | boolean | { +export type TypesResponse = number | string | boolean | { [key: string]: unknown; }; -export type UploadUploadFileData = { +export type UploadFileData = { /** * Supply a file reference for upload */ file: (Blob | File); }; -export type UploadUploadFileResponse = boolean; +export type UploadFileResponse = boolean; -export type FileResponseFileResponseData = { +export type FileResponseData = { id: string; }; -export type FileResponseFileResponseResponse = (Blob | File); +export type FileResponseResponse = (Blob | File); -export type ComplexComplexTypesData = { +export type ComplexTypesData = { /** * Parameter containing object */ @@ -1194,9 +1186,9 @@ export type ComplexComplexTypesData = { parameterReference: ModelWithString; }; -export type ComplexComplexTypesResponse = Array; +export type ComplexTypesResponse = Array; -export type ComplexComplexParamsData = { +export type ComplexParamsData = { id: number; requestBody?: { readonly key: string | null; @@ -1213,16 +1205,16 @@ export type ComplexComplexParamsData = { }; }; -export type ComplexComplexParamsResponse = ModelWithString; +export type ComplexParamsResponse = ModelWithString; -export type MultipartMultipartRequestData = { +export type MultipartRequestData = { formData?: { content?: (Blob | File); data?: ModelWithString | null; }; }; -export type MultipartMultipartResponseResponse = { +export type MultipartResponseResponse = { file?: (Blob | File); metadata?: { foo?: string; @@ -1230,25 +1222,25 @@ export type MultipartMultipartResponseResponse = { }; }; -export type HeaderCallWithResultFromHeaderResponse = string; +export type CallWithResultFromHeaderResponse = string; -export type ErrorTestErrorCodeData = { +export type TestErrorCodeData = { /** * Status code to return */ status: number; }; -export type ErrorTestErrorCodeResponse = unknown; +export type TestErrorCodeResponse = unknown; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data = { +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { /** * Dummy input param */ nonAsciiParamæøåÆøÅöôêÊ: number; }; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response = Array; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = Array; export type $OpenApiTs = { '/api/v{api-version}/no-tag': { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap index 86d9c090c..c5d58d315 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DefaultPostServiceWithEmptyTagData, DefaultPostServiceWithEmptyTagResponse, SimpleApiVversionOdataControllerCountResponse, ParametersDeleteFooData, ParametersCallWithParametersData, ParametersCallWithWeirdParameterNamesData, ParametersGetCallWithOptionalParamData, ParametersPostCallWithOptionalParamData, DescriptionsCallWithDescriptionsData, DeprecatedDeprecatedCallData, RequestBodyPostApiRequestBodyData, FormDataPostApiFormDataData, DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData, NoContentCallWithNoContentResponseResponse, NoContentCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseAndNoContentResponseResponse, ResponseCallWithResponseResponse, ResponseCallWithDuplicateResponsesResponse, ResponseCallWithResponsesResponse, MultipleTags1DummyAResponse, MultipleTags1DummyBResponse, MultipleTags2DummyAResponse, MultipleTags2DummyBResponse, MultipleTags3DummyBResponse, CollectionFormatCollectionFormatData, TypesTypesData, TypesTypesResponse, UploadUploadFileData, UploadUploadFileResponse, FileResponseFileResponseData, FileResponseFileResponseResponse, ComplexComplexTypesData, ComplexComplexTypesResponse, ComplexComplexParamsData, ComplexComplexParamsResponse, MultipartMultipartRequestData, MultipartMultipartResponseResponse, HeaderCallWithResultFromHeaderResponse, ErrorTestErrorCodeData, ErrorTestErrorCodeResponse, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; +import type { PostServiceWithEmptyTagData, PostServiceWithEmptyTagResponse, ApiVversionOdataControllerCountResponse, DeleteFooData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from './types.gen'; export class DefaultService { /** @@ -22,7 +22,7 @@ export class DefaultService { * @returns ModelWithReadOnlyAndWriteOnly * @throws ApiError */ - public static postServiceWithEmptyTag(data: DefaultPostServiceWithEmptyTagData): CancelablePromise { + public static postServiceWithEmptyTag(data: PostServiceWithEmptyTagData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/no-tag', @@ -38,7 +38,7 @@ export class SimpleService { * @returns Model_From_Zendesk Success * @throws ApiError */ - public static apiVVersionOdataControllerCount(): CancelablePromise { + public static apiVVersionOdataControllerCount(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/simple/$count' @@ -124,7 +124,7 @@ export class ParametersService { * @param data.bar bar in method * @throws ApiError */ - public static deleteFoo(data: ParametersDeleteFooData): CancelablePromise { + public static deleteFoo(data: DeleteFooData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v{api-version}/foo/{foo}/bar/{bar}', @@ -147,7 +147,7 @@ export class ParametersService { * @param data.fooRefEnum * @throws ApiError */ - public static callWithParameters(data: ParametersCallWithParametersData): CancelablePromise { + public static callWithParameters(data: CallWithParametersData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -186,7 +186,7 @@ export class ParametersService { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public static callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): CancelablePromise { + public static callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -219,7 +219,7 @@ export class ParametersService { * @param data.parameter This is an optional parameter * @throws ApiError */ - public static getCallWithOptionalParam(data: ParametersGetCallWithOptionalParamData): CancelablePromise { + public static getCallWithOptionalParam(data: GetCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/parameters/', @@ -237,7 +237,7 @@ export class ParametersService { * @param data.requestBody This is an optional parameter * @throws ApiError */ - public static postCallWithOptionalParam(data: ParametersPostCallWithOptionalParamData): CancelablePromise { + public static postCallWithOptionalParam(data: PostCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/', @@ -265,7 +265,7 @@ export class DescriptionsService { * @param data.parameterWithReservedCharacters Testing reserved characters in string: * inline * and ** inline ** should work * @throws ApiError */ - public static callWithDescriptions(data: DescriptionsCallWithDescriptionsData = {}): CancelablePromise { + public static callWithDescriptions(data: CallWithDescriptionsData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/descriptions/', @@ -289,7 +289,7 @@ export class DeprecatedService { * @param data.parameter This parameter is deprecated * @throws ApiError */ - public static deprecatedCall(data: DeprecatedDeprecatedCallData): CancelablePromise { + public static deprecatedCall(data: DeprecatedCallData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/deprecated', @@ -308,7 +308,7 @@ export class RequestBodyService { * @param data.foo A reusable request body * @throws ApiError */ - public static postApiRequestBody(data: RequestBodyPostApiRequestBodyData = {}): CancelablePromise { + public static postApiRequestBody(data: PostApiRequestBodyData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/requestBody/', @@ -329,7 +329,7 @@ export class FormDataService { * @param data.formData A reusable request body * @throws ApiError */ - public static postApiFormData(data: FormDataPostApiFormDataData = {}): CancelablePromise { + public static postApiFormData(data: PostApiFormDataData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/formData/', @@ -353,7 +353,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public static callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData = {}): CancelablePromise { + public static callWithDefaultParameters(data: CallWithDefaultParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/defaults', @@ -376,7 +376,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public static callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): CancelablePromise { + public static callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/defaults', @@ -402,7 +402,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public static callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): CancelablePromise { + public static callToTestOrderOfParams(data: CallToTestOrderOfParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/defaults', @@ -469,7 +469,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithNoContentResponse(): CancelablePromise { + public static callWithNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/no-content' @@ -481,7 +481,7 @@ export class NoContentService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -496,7 +496,7 @@ export class ResponseService { * @returns void Success * @throws ApiError */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { + public static callWithResponseAndNoContentResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/response-and-no-content' @@ -507,7 +507,7 @@ export class ResponseService { * @returns ModelWithString * @throws ApiError */ - public static callWithResponse(): CancelablePromise { + public static callWithResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/response' @@ -520,7 +520,7 @@ export class ResponseService { * @returns ModelWithBoolean Message for default response * @throws ApiError */ - public static callWithDuplicateResponses(): CancelablePromise { + public static callWithDuplicateResponses(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/response', @@ -539,7 +539,7 @@ export class ResponseService { * @returns ModelWithString Message for default response * @throws ApiError */ - public static callWithResponses(): CancelablePromise { + public static callWithResponses(): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/response', @@ -558,7 +558,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -569,7 +569,7 @@ export class MultipleTags1Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -583,7 +583,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyA(): CancelablePromise { + public static dummyA(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/a' @@ -594,7 +594,7 @@ export class MultipleTags2Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -608,7 +608,7 @@ export class MultipleTags3Service { * @returns void Success * @throws ApiError */ - public static dummyB(): CancelablePromise { + public static dummyB(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multiple-tags/b' @@ -627,7 +627,7 @@ export class CollectionFormatService { * @param data.parameterArrayMulti This is an array parameter that is sent as multi format (multiple parameter instances) * @throws ApiError */ - public static collectionFormat(data: CollectionFormatCollectionFormatData): CancelablePromise { + public static collectionFormat(data: CollectionFormatData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/collectionFormat', @@ -660,7 +660,7 @@ export class TypesService { * @returns unknown Response is a simple object * @throws ApiError */ - public static types(data: TypesTypesData): CancelablePromise { + public static types(data: TypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/types', @@ -688,7 +688,7 @@ export class UploadService { * @returns boolean * @throws ApiError */ - public static uploadFile(data: UploadUploadFileData): CancelablePromise { + public static uploadFile(data: UploadFileData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/upload', @@ -707,7 +707,7 @@ export class FileResponseService { * @returns binary Success * @throws ApiError */ - public static fileResponse(data: FileResponseFileResponseData): CancelablePromise { + public static fileResponse(data: FileResponseData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/file/{id}', @@ -727,7 +727,7 @@ export class ComplexService { * @returns ModelWithString Successful response * @throws ApiError */ - public static complexTypes(data: ComplexComplexTypesData): CancelablePromise { + public static complexTypes(data: ComplexTypesData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/complex', @@ -749,7 +749,7 @@ export class ComplexService { * @returns ModelWithString Success * @throws ApiError */ - public static complexParams(data: ComplexComplexParamsData): CancelablePromise { + public static complexParams(data: ComplexParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/complex/{id}', @@ -769,7 +769,7 @@ export class MultipartService { * @param data.formData * @throws ApiError */ - public static multipartRequest(data: MultipartMultipartRequestData = {}): CancelablePromise { + public static multipartRequest(data: MultipartRequestData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/multipart', @@ -782,7 +782,7 @@ export class MultipartService { * @returns unknown OK * @throws ApiError */ - public static multipartResponse(): CancelablePromise { + public static multipartResponse(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/multipart' @@ -796,7 +796,7 @@ export class HeaderService { * @returns string Successful response * @throws ApiError */ - public static callWithResultFromHeader(): CancelablePromise { + public static callWithResultFromHeader(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/header', @@ -817,7 +817,7 @@ export class ErrorService { * @returns unknown Custom message: Successful response * @throws ApiError */ - public static testErrorCode(data: ErrorTestErrorCodeData): CancelablePromise { + public static testErrorCode(data: TestErrorCodeData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/error', @@ -842,7 +842,7 @@ export class NonAsciiÆøåÆøÅöôêÊService { * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response * @throws ApiError */ - public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { + public static nonAsciiæøåÆøÅöôêÊ字符串(data: NonAsciiæøåÆøÅöôêÊ字符串Data): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap index 62ddfec84..71b60b9f6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap @@ -820,15 +820,15 @@ export type ParameterSimpleParameter = string; */ export type Parameterx_Foo_Bar = string; -export type DefaultPostServiceWithEmptyTagData = { +export type PostServiceWithEmptyTagData = { requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; }; -export type DefaultPostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; +export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly; -export type SimpleApiVversionOdataControllerCountResponse = Model_From_Zendesk; +export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk; -export type ParametersDeleteFooData = { +export type DeleteFooData = { /** * bar in method */ @@ -839,7 +839,7 @@ export type ParametersDeleteFooData = { foo: string; }; -export type ParametersCallWithParametersData = { +export type CallWithParametersData = { fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; /** @@ -868,7 +868,7 @@ export type ParametersCallWithParametersData = { requestBody: ModelWithString | null; }; -export type ParametersCallWithWeirdParameterNamesData = { +export type CallWithWeirdParameterNamesData = { /** * This is the parameter with a reserved keyword */ @@ -907,7 +907,7 @@ export type ParametersCallWithWeirdParameterNamesData = { requestBody: ModelWithString | null; }; -export type ParametersGetCallWithOptionalParamData = { +export type GetCallWithOptionalParamData = { /** * This is an optional parameter */ @@ -918,7 +918,7 @@ export type ParametersGetCallWithOptionalParamData = { requestBody: ModelWithOneOfEnum; }; -export type ParametersPostCallWithOptionalParamData = { +export type PostCallWithOptionalParamData = { /** * This is a required parameter */ @@ -929,7 +929,7 @@ export type ParametersPostCallWithOptionalParamData = { requestBody?: ModelWithString; }; -export type DescriptionsCallWithDescriptionsData = { +export type CallWithDescriptionsData = { /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ @@ -959,7 +959,7 @@ export type DescriptionsCallWithDescriptionsData = { parameterWithSlashes?: unknown; }; -export type DeprecatedDeprecatedCallData = { +export type DeprecatedCallData = { /** * This parameter is deprecated * @deprecated @@ -967,7 +967,7 @@ export type DeprecatedDeprecatedCallData = { parameter: DeprecatedModel | null; }; -export type RequestBodyPostApiRequestBodyData = { +export type PostApiRequestBodyData = { /** * A reusable request body */ @@ -978,7 +978,7 @@ export type RequestBodyPostApiRequestBodyData = { parameter?: string; }; -export type FormDataPostApiFormDataData = { +export type PostApiFormDataData = { /** * A reusable request body */ @@ -989,7 +989,7 @@ export type FormDataPostApiFormDataData = { parameter?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -1012,7 +1012,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString?: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -1035,7 +1035,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ @@ -1070,33 +1070,25 @@ export type DefaultsCallToTestOrderOfParamsData = { parameterStringWithNoDefault: string; }; -export type NoContentCallWithNoContentResponseResponse = void; +export type CallWithNoContentResponseResponse = void; -export type NoContentCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseAndNoContentResponseResponse = number | void; -export type ResponseCallWithResponseAndNoContentResponseResponse = number | void; +export type CallWithResponseResponse = ModelWithString; -export type ResponseCallWithResponseResponse = ModelWithString; +export type CallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; -export type ResponseCallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString | ModelWithBoolean; - -export type ResponseCallWithResponsesResponse = { +export type CallWithResponsesResponse = { readonly '@namespace.string'?: string; readonly '@namespace.integer'?: number; readonly value?: Array; } | ModelThatExtends | ModelThatExtendsExtends | ModelWithString; -export type MultipleTags1DummyAResponse = void; - -export type MultipleTags1DummyBResponse = void; - -export type MultipleTags2DummyAResponse = void; - -export type MultipleTags2DummyBResponse = void; +export type DummyAResponse = void; -export type MultipleTags3DummyBResponse = void; +export type DummyBResponse = void; -export type CollectionFormatCollectionFormatData = { +export type CollectionFormatData = { /** * This is an array parameter that is sent as csv format (comma-separated values) */ @@ -1119,7 +1111,7 @@ export type CollectionFormatCollectionFormatData = { parameterArrayTsv: Array<(string)> | null; }; -export type TypesTypesData = { +export type TypesData = { /** * This is a number parameter */ @@ -1158,26 +1150,26 @@ export type TypesTypesData = { parameterString: string | null; }; -export type TypesTypesResponse = number | string | boolean | { +export type TypesResponse = number | string | boolean | { [key: string]: unknown; }; -export type UploadUploadFileData = { +export type UploadFileData = { /** * Supply a file reference for upload */ file: (Blob | File); }; -export type UploadUploadFileResponse = boolean; +export type UploadFileResponse = boolean; -export type FileResponseFileResponseData = { +export type FileResponseData = { id: string; }; -export type FileResponseFileResponseResponse = (Blob | File); +export type FileResponseResponse = (Blob | File); -export type ComplexComplexTypesData = { +export type ComplexTypesData = { /** * Parameter containing object */ @@ -1194,9 +1186,9 @@ export type ComplexComplexTypesData = { parameterReference: ModelWithString; }; -export type ComplexComplexTypesResponse = Array; +export type ComplexTypesResponse = Array; -export type ComplexComplexParamsData = { +export type ComplexParamsData = { id: number; requestBody?: { readonly key: string | null; @@ -1213,16 +1205,16 @@ export type ComplexComplexParamsData = { }; }; -export type ComplexComplexParamsResponse = ModelWithString; +export type ComplexParamsResponse = ModelWithString; -export type MultipartMultipartRequestData = { +export type MultipartRequestData = { formData?: { content?: (Blob | File); data?: ModelWithString | null; }; }; -export type MultipartMultipartResponseResponse = { +export type MultipartResponseResponse = { file?: (Blob | File); metadata?: { foo?: string; @@ -1230,25 +1222,25 @@ export type MultipartMultipartResponseResponse = { }; }; -export type HeaderCallWithResultFromHeaderResponse = string; +export type CallWithResultFromHeaderResponse = string; -export type ErrorTestErrorCodeData = { +export type TestErrorCodeData = { /** * Status code to return */ status: number; }; -export type ErrorTestErrorCodeResponse = unknown; +export type TestErrorCodeResponse = unknown; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Data = { +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { /** * Dummy input param */ nonAsciiParamæøåÆøÅöôêÊ: number; }; -export type NonAsciiÆøåÆøÅöôêÊNonAsciiæøåÆøÅöôêÊ字符串Response = Array; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = Array; export type $OpenApiTs = { '/api/v{api-version}/no-tag': { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap index f4e3829b7..6856f018b 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData } from './types.gen'; +import type { CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData } from './types.gen'; export class DefaultsService { /** @@ -14,7 +14,7 @@ export class DefaultsService { * @param parameterModel This is a simple model with default value * @throws ApiError */ - public static callWithDefaultParameters(parameterString: DefaultsCallWithDefaultParametersData['parameterString'] = 'Hello World!', parameterNumber: DefaultsCallWithDefaultParametersData['parameterNumber'] = 123, parameterBoolean: DefaultsCallWithDefaultParametersData['parameterBoolean'] = true, parameterEnum: DefaultsCallWithDefaultParametersData['parameterEnum'] = 'Success', parameterModel: DefaultsCallWithDefaultParametersData['parameterModel'] = { + public static callWithDefaultParameters(parameterString: CallWithDefaultParametersData['parameterString'] = 'Hello World!', parameterNumber: CallWithDefaultParametersData['parameterNumber'] = 123, parameterBoolean: CallWithDefaultParametersData['parameterBoolean'] = true, parameterEnum: CallWithDefaultParametersData['parameterEnum'] = 'Success', parameterModel: CallWithDefaultParametersData['parameterModel'] = { prop: 'Hello World!' }): CancelablePromise { return __request(OpenAPI, { @@ -38,7 +38,7 @@ export class DefaultsService { * @param parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public static callWithDefaultOptionalParameters(parameterString: DefaultsCallWithDefaultOptionalParametersData['parameterString'] = 'Hello World!', parameterNumber: DefaultsCallWithDefaultOptionalParametersData['parameterNumber'] = 123, parameterBoolean: DefaultsCallWithDefaultOptionalParametersData['parameterBoolean'] = true, parameterEnum: DefaultsCallWithDefaultOptionalParametersData['parameterEnum'] = 'Success', parameterModel: DefaultsCallWithDefaultOptionalParametersData['parameterModel'] = { + public static callWithDefaultOptionalParameters(parameterString: CallWithDefaultOptionalParametersData['parameterString'] = 'Hello World!', parameterNumber: CallWithDefaultOptionalParametersData['parameterNumber'] = 123, parameterBoolean: CallWithDefaultOptionalParametersData['parameterBoolean'] = true, parameterEnum: CallWithDefaultOptionalParametersData['parameterEnum'] = 'Success', parameterModel: CallWithDefaultOptionalParametersData['parameterModel'] = { prop: 'Hello World!' }): CancelablePromise { return __request(OpenAPI, { @@ -65,7 +65,7 @@ export class DefaultsService { * @param parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public static callToTestOrderOfParams(parameterStringWithNoDefault: DefaultsCallToTestOrderOfParamsData['parameterStringWithNoDefault'], parameterOptionalStringWithDefault: DefaultsCallToTestOrderOfParamsData['parameterOptionalStringWithDefault'] = 'Hello World!', parameterOptionalStringWithEmptyDefault: DefaultsCallToTestOrderOfParamsData['parameterOptionalStringWithEmptyDefault'] = '', parameterOptionalStringWithNoDefault?: DefaultsCallToTestOrderOfParamsData['parameterOptionalStringWithNoDefault'], parameterStringWithDefault: DefaultsCallToTestOrderOfParamsData['parameterStringWithDefault'] = 'Hello World!', parameterStringWithEmptyDefault: DefaultsCallToTestOrderOfParamsData['parameterStringWithEmptyDefault'] = '', parameterStringNullableWithNoDefault?: DefaultsCallToTestOrderOfParamsData['parameterStringNullableWithNoDefault'], parameterStringNullableWithDefault: DefaultsCallToTestOrderOfParamsData['parameterStringNullableWithDefault'] = null): CancelablePromise { + public static callToTestOrderOfParams(parameterStringWithNoDefault: CallToTestOrderOfParamsData['parameterStringWithNoDefault'], parameterOptionalStringWithDefault: CallToTestOrderOfParamsData['parameterOptionalStringWithDefault'] = 'Hello World!', parameterOptionalStringWithEmptyDefault: CallToTestOrderOfParamsData['parameterOptionalStringWithEmptyDefault'] = '', parameterOptionalStringWithNoDefault?: CallToTestOrderOfParamsData['parameterOptionalStringWithNoDefault'], parameterStringWithDefault: CallToTestOrderOfParamsData['parameterStringWithDefault'] = 'Hello World!', parameterStringWithEmptyDefault: CallToTestOrderOfParamsData['parameterStringWithEmptyDefault'] = '', parameterStringNullableWithNoDefault?: CallToTestOrderOfParamsData['parameterStringNullableWithNoDefault'], parameterStringNullableWithDefault: CallToTestOrderOfParamsData['parameterStringNullableWithDefault'] = null): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/defaults', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap index 92ea597ed..0203356d4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap @@ -20,7 +20,7 @@ export type ModelWithStringError = { prop?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -43,7 +43,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -66,7 +66,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap index a7bea07b8..5ba5878ab 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { DefaultsCallWithDefaultParametersData, DefaultsCallWithDefaultOptionalParametersData, DefaultsCallToTestOrderOfParamsData } from './types.gen'; +import type { CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData } from './types.gen'; export class DefaultsService { /** @@ -15,7 +15,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model with default value * @throws ApiError */ - public static callWithDefaultParameters(data: DefaultsCallWithDefaultParametersData = {}): CancelablePromise { + public static callWithDefaultParameters(data: CallWithDefaultParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/defaults', @@ -38,7 +38,7 @@ export class DefaultsService { * @param data.parameterModel This is a simple model that is optional with default value * @throws ApiError */ - public static callWithDefaultOptionalParameters(data: DefaultsCallWithDefaultOptionalParametersData = {}): CancelablePromise { + public static callWithDefaultOptionalParameters(data: CallWithDefaultOptionalParametersData = {}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/defaults', @@ -64,7 +64,7 @@ export class DefaultsService { * @param data.parameterStringNullableWithDefault This is a string that can be null with default * @throws ApiError */ - public static callToTestOrderOfParams(data: DefaultsCallToTestOrderOfParamsData): CancelablePromise { + public static callToTestOrderOfParams(data: CallToTestOrderOfParamsData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v{api-version}/defaults', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap index 3750b35f7..1c6580095 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap @@ -20,7 +20,7 @@ export type ModelWithStringError = { prop?: string; }; -export type DefaultsCallWithDefaultParametersData = { +export type CallWithDefaultParametersData = { /** * This is a simple boolean with default value */ @@ -43,7 +43,7 @@ export type DefaultsCallWithDefaultParametersData = { parameterString?: string | null; }; -export type DefaultsCallWithDefaultOptionalParametersData = { +export type CallWithDefaultOptionalParametersData = { /** * This is a simple boolean that is optional with default value */ @@ -66,7 +66,7 @@ export type DefaultsCallWithDefaultOptionalParametersData = { parameterString?: string; }; -export type DefaultsCallToTestOrderOfParamsData = { +export type CallToTestOrderOfParamsData = { /** * This is a optional string with default */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap index 444ebc85d..18caef5d4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap @@ -9,7 +9,7 @@ export class myAwesomeSimpleApi { * @returns Model_From_Zendesk Success * @throws ApiError */ - public static apiVVersionOdataControllerCount(): CancelablePromise { + public static apiVVersionOdataControllerCount(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/simple/$count' @@ -95,7 +95,7 @@ export class myAwesomeParametersApi { * @param data.bar bar in method * @throws ApiError */ - public static deleteFoo(data: ParametersDeleteFooData): CancelablePromise { + public static deleteFoo(data: DeleteFooData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v{api-version}/foo/{foo}/bar/{bar}', @@ -118,7 +118,7 @@ export class myAwesomeParametersApi { * @param data.fooRefEnum * @throws ApiError */ - public static callWithParameters(data: ParametersCallWithParametersData): CancelablePromise { + public static callWithParameters(data: CallWithParametersData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameterPath}', @@ -157,7 +157,7 @@ export class myAwesomeParametersApi { * @param data._default This is the parameter with a reserved keyword * @throws ApiError */ - public static callWithWeirdParameterNames(data: ParametersCallWithWeirdParameterNamesData): CancelablePromise { + public static callWithWeirdParameterNames(data: CallWithWeirdParameterNamesData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', @@ -190,7 +190,7 @@ export class myAwesomeParametersApi { * @param data.parameter This is an optional parameter * @throws ApiError */ - public static getCallWithOptionalParam(data: ParametersGetCallWithOptionalParamData): CancelablePromise { + public static getCallWithOptionalParam(data: GetCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v{api-version}/parameters/', @@ -208,7 +208,7 @@ export class myAwesomeParametersApi { * @param data.requestBody This is an optional parameter * @throws ApiError */ - public static postCallWithOptionalParam(data: ParametersPostCallWithOptionalParamData): CancelablePromise { + public static postCallWithOptionalParam(data: PostCallWithOptionalParamData): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v{api-version}/parameters/',