diff --git a/examples/advanced/src/gen/models/ts/petController/AddPet.ts b/examples/advanced/src/gen/models/ts/petController/AddPet.ts index 161ae987d..347eb5550 100644 --- a/examples/advanced/src/gen/models/ts/petController/AddPet.ts +++ b/examples/advanced/src/gen/models/ts/petController/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from '../Pet' import type { AddPetRequest } from '../AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Omit, 'name'> + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Omit, 'name'> export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/advanced/src/gen/models/ts/petController/DeletePet.ts b/examples/advanced/src/gen/models/ts/petController/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/advanced/src/gen/models/ts/petController/DeletePet.ts +++ b/examples/advanced/src/gen/models/ts/petController/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/advanced/src/gen/models/ts/petController/FindPetsByStatus.ts b/examples/advanced/src/gen/models/ts/petController/FindPetsByStatus.ts index bed635af2..cdc1a1dcb 100644 --- a/examples/advanced/src/gen/models/ts/petController/FindPetsByStatus.ts +++ b/examples/advanced/src/gen/models/ts/petController/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from '../Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export enum FindPetsByStatusQueryParamsStatusEnum { 'available' = 'available', 'pending' = 'pending', @@ -28,6 +18,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/advanced/src/gen/models/ts/petController/FindPetsByTags.ts b/examples/advanced/src/gen/models/ts/petController/FindPetsByTags.ts index 2aead4a58..7454baac3 100644 --- a/examples/advanced/src/gen/models/ts/petController/FindPetsByTags.ts +++ b/examples/advanced/src/gen/models/ts/petController/FindPetsByTags.ts @@ -1,29 +1,5 @@ import type { Pet } from '../Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - -export const FindPetsByTagsHeaderParamsXExampleEnum = { - 'ONE': 'ONE', - 'TWO': 'TWO', - 'THREE': 'THREE', -} as const -export type FindPetsByTagsHeaderParamsXExampleEnum = (typeof FindPetsByTagsHeaderParamsXExampleEnum)[keyof typeof FindPetsByTagsHeaderParamsXExampleEnum] -export type FindPetsByTagsHeaderParams = { - /** - * @description Header parameters - * @type string - */ - 'X-EXAMPLE': FindPetsByTagsHeaderParamsXExampleEnum -} - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -42,10 +18,35 @@ export type FindPetsByTagsQueryParams = { pageSize?: string } +export const FindPetsByTagsHeaderParamsXExampleEnum = { + 'ONE': 'ONE', + 'TWO': 'TWO', + 'THREE': 'THREE', +} as const +export type FindPetsByTagsHeaderParamsXExampleEnum = (typeof FindPetsByTagsHeaderParamsXExampleEnum)[keyof typeof FindPetsByTagsHeaderParamsXExampleEnum] +export type FindPetsByTagsHeaderParams = { + /** + * @description Header parameters + * @type string + */ + 'X-EXAMPLE': FindPetsByTagsHeaderParamsXExampleEnum +} + /** * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/advanced/src/gen/models/ts/petController/GetPetById.ts b/examples/advanced/src/gen/models/ts/petController/GetPetById.ts index 4c59f315c..7c18ee753 100644 --- a/examples/advanced/src/gen/models/ts/petController/GetPetById.ts +++ b/examples/advanced/src/gen/models/ts/petController/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from '../Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Omit, 'name'> + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Omit, 'name'> export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/advanced/src/gen/models/ts/petController/UpdatePet.ts b/examples/advanced/src/gen/models/ts/petController/UpdatePet.ts index 7a14e5bea..015ff2cae 100644 --- a/examples/advanced/src/gen/models/ts/petController/UpdatePet.ts +++ b/examples/advanced/src/gen/models/ts/petController/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from '../Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Omit, 'name'> + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Omit, 'id'> + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Omit, 'id'> - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Omit, 'name'> export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts b/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts +++ b/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/advanced/src/gen/models/ts/petController/UploadFile.ts b/examples/advanced/src/gen/models/ts/petController/UploadFile.ts index 9ccfba5f0..9a2393aba 100644 --- a/examples/advanced/src/gen/models/ts/petController/UploadFile.ts +++ b/examples/advanced/src/gen/models/ts/petController/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from '../ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts b/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts index d477dcd16..0d2c8b231 100644 --- a/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts +++ b/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts @@ -1,14 +1,20 @@ import type { PetNotFound } from '../PetNotFound' -/** - * @description Null response - */ -export type CreatePets201 = any +export type CreatePetsPathParams = { + /** + * @description UUID + * @type string + */ + uuid: string +} -/** - * @description unexpected error - */ -export type CreatePetsError = PetNotFound +export type CreatePetsQueryParams = { + /** + * @description Offset + * @type integer | undefined + */ + offset?: number +} export const CreatePetsHeaderParamsXExampleEnum = { 'ONE': 'ONE', @@ -24,6 +30,8 @@ export type CreatePetsHeaderParams = { 'X-EXAMPLE': CreatePetsHeaderParamsXExampleEnum } +export type CreatePetsMutationResponse = any + export type CreatePetsMutationRequest = { /** * @type string @@ -35,23 +43,16 @@ export type CreatePetsMutationRequest = { tag: string } -export type CreatePetsMutationResponse = any +/** + * @description Null response + */ +export type CreatePets201 = any -export type CreatePetsPathParams = { - /** - * @description UUID - * @type string - */ - uuid: string -} +/** + * @description unexpected error + */ +export type CreatePetsError = PetNotFound -export type CreatePetsQueryParams = { - /** - * @description Offset - * @type integer | undefined - */ - offset?: number -} export type CreatePetsMutation = { Response: CreatePetsMutationResponse Request: CreatePetsMutationRequest diff --git a/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts b/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts +++ b/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/advanced/src/gen/models/ts/storeController/GetInventory.ts b/examples/advanced/src/gen/models/ts/storeController/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/advanced/src/gen/models/ts/storeController/GetInventory.ts +++ b/examples/advanced/src/gen/models/ts/storeController/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts b/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts index 30fabced6..bf6ae4a52 100644 --- a/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts +++ b/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from '../Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/advanced/src/gen/models/ts/storeController/PlaceOrder.ts b/examples/advanced/src/gen/models/ts/storeController/PlaceOrder.ts index 540d400cc..fb2c23550 100644 --- a/examples/advanced/src/gen/models/ts/storeController/PlaceOrder.ts +++ b/examples/advanced/src/gen/models/ts/storeController/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from '../Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/advanced/src/gen/models/ts/storeController/PlaceOrderPatch.ts b/examples/advanced/src/gen/models/ts/storeController/PlaceOrderPatch.ts index e217104e1..929f49c7d 100644 --- a/examples/advanced/src/gen/models/ts/storeController/PlaceOrderPatch.ts +++ b/examples/advanced/src/gen/models/ts/storeController/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from '../Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/advanced/src/gen/models/ts/userController/CreateUser.ts b/examples/advanced/src/gen/models/ts/userController/CreateUser.ts index 26b210cdf..024d575a9 100644 --- a/examples/advanced/src/gen/models/ts/userController/CreateUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts b/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts index 6eee81b61..6121e4966 100644 --- a/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from '../User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/advanced/src/gen/models/ts/userController/DeleteUser.ts b/examples/advanced/src/gen/models/ts/userController/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/advanced/src/gen/models/ts/userController/DeleteUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/advanced/src/gen/models/ts/userController/GetUserByName.ts b/examples/advanced/src/gen/models/ts/userController/GetUserByName.ts index 8de6d0ed6..2aec05eef 100644 --- a/examples/advanced/src/gen/models/ts/userController/GetUserByName.ts +++ b/examples/advanced/src/gen/models/ts/userController/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from '../User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/advanced/src/gen/models/ts/userController/LoginUser.ts b/examples/advanced/src/gen/models/ts/userController/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/advanced/src/gen/models/ts/userController/LoginUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts b/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts b/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts index 0e06b265f..4ac70efe4 100644 --- a/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/client/src/gen/models/ts/petController/AddPet.ts b/examples/client/src/gen/models/ts/petController/AddPet.ts index 0e1e058ff..e3758feb4 100644 --- a/examples/client/src/gen/models/ts/petController/AddPet.ts +++ b/examples/client/src/gen/models/ts/petController/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from '../Pet' import type { AddPetRequest } from '../AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/client/src/gen/models/ts/petController/DeletePet.ts b/examples/client/src/gen/models/ts/petController/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/client/src/gen/models/ts/petController/DeletePet.ts +++ b/examples/client/src/gen/models/ts/petController/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/client/src/gen/models/ts/petController/FindPetsByStatus.ts b/examples/client/src/gen/models/ts/petController/FindPetsByStatus.ts index 22d2d47b7..c543cc40f 100644 --- a/examples/client/src/gen/models/ts/petController/FindPetsByStatus.ts +++ b/examples/client/src/gen/models/ts/petController/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from '../Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const FindPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/client/src/gen/models/ts/petController/FindPetsByTags.ts b/examples/client/src/gen/models/ts/petController/FindPetsByTags.ts index 7e747f652..ee2643bc1 100644 --- a/examples/client/src/gen/models/ts/petController/FindPetsByTags.ts +++ b/examples/client/src/gen/models/ts/petController/FindPetsByTags.ts @@ -1,29 +1,5 @@ import type { Pet } from '../Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - -export const FindPetsByTagsHeaderParamsXExample = { - 'ONE': 'ONE', - 'TWO': 'TWO', - 'THREE': 'THREE', -} as const -export type FindPetsByTagsHeaderParamsXExample = (typeof FindPetsByTagsHeaderParamsXExample)[keyof typeof FindPetsByTagsHeaderParamsXExample] -export type FindPetsByTagsHeaderParams = { - /** - * @description Header parameters - * @type string - */ - 'X-EXAMPLE': FindPetsByTagsHeaderParamsXExample -} - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -42,10 +18,35 @@ export type FindPetsByTagsQueryParams = { pageSize?: string } +export const FindPetsByTagsHeaderParamsXExample = { + 'ONE': 'ONE', + 'TWO': 'TWO', + 'THREE': 'THREE', +} as const +export type FindPetsByTagsHeaderParamsXExample = (typeof FindPetsByTagsHeaderParamsXExample)[keyof typeof FindPetsByTagsHeaderParamsXExample] +export type FindPetsByTagsHeaderParams = { + /** + * @description Header parameters + * @type string + */ + 'X-EXAMPLE': FindPetsByTagsHeaderParamsXExample +} + /** * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/client/src/gen/models/ts/petController/GetPetById.ts b/examples/client/src/gen/models/ts/petController/GetPetById.ts index 0d7ca381e..510b2f2eb 100644 --- a/examples/client/src/gen/models/ts/petController/GetPetById.ts +++ b/examples/client/src/gen/models/ts/petController/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from '../Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/client/src/gen/models/ts/petController/UpdatePet.ts b/examples/client/src/gen/models/ts/petController/UpdatePet.ts index fdd1b37c6..48e363da3 100644 --- a/examples/client/src/gen/models/ts/petController/UpdatePet.ts +++ b/examples/client/src/gen/models/ts/petController/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from '../Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts b/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts +++ b/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/client/src/gen/models/ts/petController/UploadFile.ts b/examples/client/src/gen/models/ts/petController/UploadFile.ts index 9ccfba5f0..9a2393aba 100644 --- a/examples/client/src/gen/models/ts/petController/UploadFile.ts +++ b/examples/client/src/gen/models/ts/petController/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from '../ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/client/src/gen/models/ts/petsController/CreatePets.ts b/examples/client/src/gen/models/ts/petsController/CreatePets.ts index 18a20ac2d..37aa9b99a 100644 --- a/examples/client/src/gen/models/ts/petsController/CreatePets.ts +++ b/examples/client/src/gen/models/ts/petsController/CreatePets.ts @@ -1,14 +1,20 @@ import type { PetNotFound } from '../PetNotFound' -/** - * @description Null response - */ -export type CreatePets201 = any +export type CreatePetsPathParams = { + /** + * @description UUID + * @type string + */ + uuid: string +} -/** - * @description unexpected error - */ -export type CreatePetsError = PetNotFound +export type CreatePetsQueryParams = { + /** + * @description Offset + * @type integer | undefined + */ + offset?: number +} export const CreatePetsHeaderParamsXExample = { 'ONE': 'ONE', @@ -24,6 +30,8 @@ export type CreatePetsHeaderParams = { 'X-EXAMPLE': CreatePetsHeaderParamsXExample } +export type CreatePetsMutationResponse = any + export type CreatePetsMutationRequest = { /** * @type string @@ -35,23 +43,16 @@ export type CreatePetsMutationRequest = { tag: string } -export type CreatePetsMutationResponse = any +/** + * @description Null response + */ +export type CreatePets201 = any -export type CreatePetsPathParams = { - /** - * @description UUID - * @type string - */ - uuid: string -} +/** + * @description unexpected error + */ +export type CreatePetsError = PetNotFound -export type CreatePetsQueryParams = { - /** - * @description Offset - * @type integer | undefined - */ - offset?: number -} export type CreatePetsMutation = { Response: CreatePetsMutationResponse Request: CreatePetsMutationRequest diff --git a/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts b/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts +++ b/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/client/src/gen/models/ts/storeController/GetInventory.ts b/examples/client/src/gen/models/ts/storeController/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/client/src/gen/models/ts/storeController/GetInventory.ts +++ b/examples/client/src/gen/models/ts/storeController/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/client/src/gen/models/ts/storeController/GetOrderById.ts b/examples/client/src/gen/models/ts/storeController/GetOrderById.ts index 30fabced6..bf6ae4a52 100644 --- a/examples/client/src/gen/models/ts/storeController/GetOrderById.ts +++ b/examples/client/src/gen/models/ts/storeController/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from '../Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/client/src/gen/models/ts/storeController/PlaceOrder.ts b/examples/client/src/gen/models/ts/storeController/PlaceOrder.ts index 540d400cc..fb2c23550 100644 --- a/examples/client/src/gen/models/ts/storeController/PlaceOrder.ts +++ b/examples/client/src/gen/models/ts/storeController/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from '../Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/client/src/gen/models/ts/storeController/PlaceOrderPatch.ts b/examples/client/src/gen/models/ts/storeController/PlaceOrderPatch.ts index e217104e1..929f49c7d 100644 --- a/examples/client/src/gen/models/ts/storeController/PlaceOrderPatch.ts +++ b/examples/client/src/gen/models/ts/storeController/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from '../Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/client/src/gen/models/ts/userController/CreateUser.ts b/examples/client/src/gen/models/ts/userController/CreateUser.ts index 26b210cdf..024d575a9 100644 --- a/examples/client/src/gen/models/ts/userController/CreateUser.ts +++ b/examples/client/src/gen/models/ts/userController/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts b/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts index 6eee81b61..6121e4966 100644 --- a/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts +++ b/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from '../User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/client/src/gen/models/ts/userController/DeleteUser.ts b/examples/client/src/gen/models/ts/userController/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/client/src/gen/models/ts/userController/DeleteUser.ts +++ b/examples/client/src/gen/models/ts/userController/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/client/src/gen/models/ts/userController/GetUserByName.ts b/examples/client/src/gen/models/ts/userController/GetUserByName.ts index 8de6d0ed6..2aec05eef 100644 --- a/examples/client/src/gen/models/ts/userController/GetUserByName.ts +++ b/examples/client/src/gen/models/ts/userController/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from '../User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/client/src/gen/models/ts/userController/LoginUser.ts b/examples/client/src/gen/models/ts/userController/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/client/src/gen/models/ts/userController/LoginUser.ts +++ b/examples/client/src/gen/models/ts/userController/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/client/src/gen/models/ts/userController/LogoutUser.ts b/examples/client/src/gen/models/ts/userController/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/client/src/gen/models/ts/userController/LogoutUser.ts +++ b/examples/client/src/gen/models/ts/userController/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/client/src/gen/models/ts/userController/UpdateUser.ts b/examples/client/src/gen/models/ts/userController/UpdateUser.ts index 0e06b265f..4ac70efe4 100644 --- a/examples/client/src/gen/models/ts/userController/UpdateUser.ts +++ b/examples/client/src/gen/models/ts/userController/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/faker/src/gen/models/AddPet.ts b/examples/faker/src/gen/models/AddPet.ts index 74a2fcc26..ed8b3ea9d 100644 --- a/examples/faker/src/gen/models/AddPet.ts +++ b/examples/faker/src/gen/models/AddPet.ts @@ -3,12 +3,7 @@ import type { Pet } from './Pet' /** * @description Successful operation */ -export type AddPet200 = Pet - -/** - * @description Invalid input - */ -export type AddPet405 = any +export type AddPetMutationResponse = Pet /** * @description Create a new pet in the store @@ -18,7 +13,13 @@ export type AddPetMutationRequest = Pet /** * @description Successful operation */ -export type AddPetMutationResponse = Pet +export type AddPet200 = Pet + +/** + * @description Invalid input + */ +export type AddPet405 = any + export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/faker/src/gen/models/CreateUser.ts b/examples/faker/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/faker/src/gen/models/CreateUser.ts +++ b/examples/faker/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/faker/src/gen/models/CreateUsersWithListInput.ts b/examples/faker/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/faker/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/faker/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/faker/src/gen/models/DeleteOrder.ts b/examples/faker/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/faker/src/gen/models/DeleteOrder.ts +++ b/examples/faker/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/faker/src/gen/models/DeletePet.ts b/examples/faker/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/faker/src/gen/models/DeletePet.ts +++ b/examples/faker/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/faker/src/gen/models/DeleteUser.ts b/examples/faker/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/faker/src/gen/models/DeleteUser.ts +++ b/examples/faker/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/faker/src/gen/models/FindPetsByStatus.ts b/examples/faker/src/gen/models/FindPetsByStatus.ts index 5a03a4dae..adab08cd0 100644 --- a/examples/faker/src/gen/models/FindPetsByStatus.ts +++ b/examples/faker/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/faker/src/gen/models/FindPetsByTags.ts b/examples/faker/src/gen/models/FindPetsByTags.ts index d9a5b883d..5a6878fb8 100644 --- a/examples/faker/src/gen/models/FindPetsByTags.ts +++ b/examples/faker/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -22,6 +12,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/faker/src/gen/models/GetInventory.ts b/examples/faker/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/faker/src/gen/models/GetInventory.ts +++ b/examples/faker/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/faker/src/gen/models/GetOrderById.ts b/examples/faker/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/faker/src/gen/models/GetOrderById.ts +++ b/examples/faker/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/faker/src/gen/models/GetPetById.ts b/examples/faker/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/faker/src/gen/models/GetPetById.ts +++ b/examples/faker/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/faker/src/gen/models/GetUserByName.ts b/examples/faker/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/faker/src/gen/models/GetUserByName.ts +++ b/examples/faker/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/faker/src/gen/models/LoginUser.ts b/examples/faker/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/faker/src/gen/models/LoginUser.ts +++ b/examples/faker/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/faker/src/gen/models/LogoutUser.ts b/examples/faker/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/faker/src/gen/models/LogoutUser.ts +++ b/examples/faker/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/faker/src/gen/models/PlaceOrder.ts b/examples/faker/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/faker/src/gen/models/PlaceOrder.ts +++ b/examples/faker/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/faker/src/gen/models/UpdatePet.ts b/examples/faker/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/faker/src/gen/models/UpdatePet.ts +++ b/examples/faker/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/faker/src/gen/models/UpdatePetWithForm.ts b/examples/faker/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/faker/src/gen/models/UpdatePetWithForm.ts +++ b/examples/faker/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/faker/src/gen/models/UpdateUser.ts b/examples/faker/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/faker/src/gen/models/UpdateUser.ts +++ b/examples/faker/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/faker/src/gen/models/UploadFile.ts b/examples/faker/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/faker/src/gen/models/UploadFile.ts +++ b/examples/faker/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/msw-v2/src/gen/models/AddPet.ts b/examples/msw-v2/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/msw-v2/src/gen/models/AddPet.ts +++ b/examples/msw-v2/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/msw-v2/src/gen/models/CreateUser.ts b/examples/msw-v2/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/msw-v2/src/gen/models/CreateUser.ts +++ b/examples/msw-v2/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts b/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/msw-v2/src/gen/models/DeleteOrder.ts b/examples/msw-v2/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/msw-v2/src/gen/models/DeleteOrder.ts +++ b/examples/msw-v2/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/msw-v2/src/gen/models/DeletePet.ts b/examples/msw-v2/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/msw-v2/src/gen/models/DeletePet.ts +++ b/examples/msw-v2/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/msw-v2/src/gen/models/DeleteUser.ts b/examples/msw-v2/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/msw-v2/src/gen/models/DeleteUser.ts +++ b/examples/msw-v2/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/msw-v2/src/gen/models/FindPetsByStatus.ts b/examples/msw-v2/src/gen/models/FindPetsByStatus.ts index 5a03a4dae..adab08cd0 100644 --- a/examples/msw-v2/src/gen/models/FindPetsByStatus.ts +++ b/examples/msw-v2/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/msw-v2/src/gen/models/FindPetsByTags.ts b/examples/msw-v2/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/msw-v2/src/gen/models/FindPetsByTags.ts +++ b/examples/msw-v2/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/msw-v2/src/gen/models/GetInventory.ts b/examples/msw-v2/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/msw-v2/src/gen/models/GetInventory.ts +++ b/examples/msw-v2/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/msw-v2/src/gen/models/GetOrderById.ts b/examples/msw-v2/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/msw-v2/src/gen/models/GetOrderById.ts +++ b/examples/msw-v2/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/msw-v2/src/gen/models/GetPetById.ts b/examples/msw-v2/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/msw-v2/src/gen/models/GetPetById.ts +++ b/examples/msw-v2/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/msw-v2/src/gen/models/GetUserByName.ts b/examples/msw-v2/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/msw-v2/src/gen/models/GetUserByName.ts +++ b/examples/msw-v2/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/msw-v2/src/gen/models/LoginUser.ts b/examples/msw-v2/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/msw-v2/src/gen/models/LoginUser.ts +++ b/examples/msw-v2/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/msw-v2/src/gen/models/LogoutUser.ts b/examples/msw-v2/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/msw-v2/src/gen/models/LogoutUser.ts +++ b/examples/msw-v2/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/msw-v2/src/gen/models/PlaceOrder.ts b/examples/msw-v2/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/msw-v2/src/gen/models/PlaceOrder.ts +++ b/examples/msw-v2/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/msw-v2/src/gen/models/PlaceOrderPatch.ts b/examples/msw-v2/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/msw-v2/src/gen/models/PlaceOrderPatch.ts +++ b/examples/msw-v2/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/msw-v2/src/gen/models/UpdatePet.ts b/examples/msw-v2/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/msw-v2/src/gen/models/UpdatePet.ts +++ b/examples/msw-v2/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts b/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts +++ b/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/msw-v2/src/gen/models/UpdateUser.ts b/examples/msw-v2/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/msw-v2/src/gen/models/UpdateUser.ts +++ b/examples/msw-v2/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/msw-v2/src/gen/models/UploadFile.ts b/examples/msw-v2/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/msw-v2/src/gen/models/UploadFile.ts +++ b/examples/msw-v2/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/msw/src/gen/models/AddPet.ts b/examples/msw/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/msw/src/gen/models/AddPet.ts +++ b/examples/msw/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/msw/src/gen/models/CreateUser.ts b/examples/msw/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/msw/src/gen/models/CreateUser.ts +++ b/examples/msw/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/msw/src/gen/models/CreateUsersWithListInput.ts b/examples/msw/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/msw/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/msw/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/msw/src/gen/models/DeleteOrder.ts b/examples/msw/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/msw/src/gen/models/DeleteOrder.ts +++ b/examples/msw/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/msw/src/gen/models/DeletePet.ts b/examples/msw/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/msw/src/gen/models/DeletePet.ts +++ b/examples/msw/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/msw/src/gen/models/DeleteUser.ts b/examples/msw/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/msw/src/gen/models/DeleteUser.ts +++ b/examples/msw/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/msw/src/gen/models/FindPetsByStatus.ts b/examples/msw/src/gen/models/FindPetsByStatus.ts index 5a03a4dae..adab08cd0 100644 --- a/examples/msw/src/gen/models/FindPetsByStatus.ts +++ b/examples/msw/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/msw/src/gen/models/FindPetsByTags.ts b/examples/msw/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/msw/src/gen/models/FindPetsByTags.ts +++ b/examples/msw/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/msw/src/gen/models/GetInventory.ts b/examples/msw/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/msw/src/gen/models/GetInventory.ts +++ b/examples/msw/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/msw/src/gen/models/GetOrderById.ts b/examples/msw/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/msw/src/gen/models/GetOrderById.ts +++ b/examples/msw/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/msw/src/gen/models/GetPetById.ts b/examples/msw/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/msw/src/gen/models/GetPetById.ts +++ b/examples/msw/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/msw/src/gen/models/GetUserByName.ts b/examples/msw/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/msw/src/gen/models/GetUserByName.ts +++ b/examples/msw/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/msw/src/gen/models/LoginUser.ts b/examples/msw/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/msw/src/gen/models/LoginUser.ts +++ b/examples/msw/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/msw/src/gen/models/LogoutUser.ts b/examples/msw/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/msw/src/gen/models/LogoutUser.ts +++ b/examples/msw/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/msw/src/gen/models/PlaceOrder.ts b/examples/msw/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/msw/src/gen/models/PlaceOrder.ts +++ b/examples/msw/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/msw/src/gen/models/PlaceOrderPatch.ts b/examples/msw/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/msw/src/gen/models/PlaceOrderPatch.ts +++ b/examples/msw/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/msw/src/gen/models/UpdatePet.ts b/examples/msw/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/msw/src/gen/models/UpdatePet.ts +++ b/examples/msw/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/msw/src/gen/models/UpdatePetWithForm.ts b/examples/msw/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/msw/src/gen/models/UpdatePetWithForm.ts +++ b/examples/msw/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/msw/src/gen/models/UpdateUser.ts b/examples/msw/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/msw/src/gen/models/UpdateUser.ts +++ b/examples/msw/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/msw/src/gen/models/UploadFile.ts b/examples/msw/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/msw/src/gen/models/UploadFile.ts +++ b/examples/msw/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/react-query-v5/src/gen/index.ts b/examples/react-query-v5/src/gen/index.ts index 6e6f12d44..9d83c2121 100644 --- a/examples/react-query-v5/src/gen/index.ts +++ b/examples/react-query-v5/src/gen/index.ts @@ -1,2 +1,2 @@ -export * from './models/index' export * from './hooks/index' +export * from './models/index' diff --git a/examples/react-query-v5/src/gen/models/AddPet.ts b/examples/react-query-v5/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/react-query-v5/src/gen/models/AddPet.ts +++ b/examples/react-query-v5/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/react-query-v5/src/gen/models/CreateUser.ts b/examples/react-query-v5/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/react-query-v5/src/gen/models/CreateUser.ts +++ b/examples/react-query-v5/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/react-query-v5/src/gen/models/DeleteOrder.ts b/examples/react-query-v5/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/react-query-v5/src/gen/models/DeleteOrder.ts +++ b/examples/react-query-v5/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/react-query-v5/src/gen/models/DeletePet.ts b/examples/react-query-v5/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/react-query-v5/src/gen/models/DeletePet.ts +++ b/examples/react-query-v5/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/react-query-v5/src/gen/models/DeleteUser.ts b/examples/react-query-v5/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/react-query-v5/src/gen/models/DeleteUser.ts +++ b/examples/react-query-v5/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts b/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts index 5a03a4dae..adab08cd0 100644 --- a/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts +++ b/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/react-query-v5/src/gen/models/FindPetsByTags.ts b/examples/react-query-v5/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/react-query-v5/src/gen/models/FindPetsByTags.ts +++ b/examples/react-query-v5/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/react-query-v5/src/gen/models/GetInventory.ts b/examples/react-query-v5/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/react-query-v5/src/gen/models/GetInventory.ts +++ b/examples/react-query-v5/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/react-query-v5/src/gen/models/GetOrderById.ts b/examples/react-query-v5/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/react-query-v5/src/gen/models/GetOrderById.ts +++ b/examples/react-query-v5/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/react-query-v5/src/gen/models/GetPetById.ts b/examples/react-query-v5/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/react-query-v5/src/gen/models/GetPetById.ts +++ b/examples/react-query-v5/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/react-query-v5/src/gen/models/GetUserByName.ts b/examples/react-query-v5/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/react-query-v5/src/gen/models/GetUserByName.ts +++ b/examples/react-query-v5/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/react-query-v5/src/gen/models/LoginUser.ts b/examples/react-query-v5/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/react-query-v5/src/gen/models/LoginUser.ts +++ b/examples/react-query-v5/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/react-query-v5/src/gen/models/LogoutUser.ts b/examples/react-query-v5/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/react-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/react-query-v5/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/react-query-v5/src/gen/models/PlaceOrder.ts b/examples/react-query-v5/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/react-query-v5/src/gen/models/PlaceOrder.ts +++ b/examples/react-query-v5/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts b/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts +++ b/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/react-query-v5/src/gen/models/UpdatePet.ts b/examples/react-query-v5/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/react-query-v5/src/gen/models/UpdatePet.ts +++ b/examples/react-query-v5/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts b/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts +++ b/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/react-query-v5/src/gen/models/UpdateUser.ts b/examples/react-query-v5/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/react-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/react-query-v5/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/react-query-v5/src/gen/models/UploadFile.ts b/examples/react-query-v5/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/react-query-v5/src/gen/models/UploadFile.ts +++ b/examples/react-query-v5/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/react-query-v5/templates/operations/index.tsx b/examples/react-query-v5/templates/operations/index.tsx index 7e67f1b6d..1a3dbc9d5 100644 --- a/examples/react-query-v5/templates/operations/index.tsx +++ b/examples/react-query-v5/templates/operations/index.tsx @@ -1,5 +1,5 @@ import { Editor, Type, File, usePlugin } from '@kubb/react' -import { useOperationHelpers, useOperations, useOas } from '@kubb/swagger/hooks' +import { useOperationHelpers, useOperations } from '@kubb/swagger/hooks' import { Operations } from '@kubb/swagger-tanstack-query/components' import React from 'react' import { FileMeta, PluginOptions } from '@kubb/swagger-tanstack-query' diff --git a/examples/react-query-v5/templates/queryKey/index.tsx b/examples/react-query-v5/templates/queryKey/index.tsx index 3c85fef8b..a51e80e7e 100644 --- a/examples/react-query-v5/templates/queryKey/index.tsx +++ b/examples/react-query-v5/templates/queryKey/index.tsx @@ -1,5 +1,5 @@ import { Editor, Type, Function } from '@kubb/react' -import { useOperation, useSchemas } from '@kubb/swagger/hooks' +import { useOperation, useOperationSchemas } from '@kubb/swagger/hooks' import { QueryKey } from '@kubb/swagger-tanstack-query/components' import React from 'react' import { URLObject, URLPath } from '@kubb/core/utils' @@ -7,7 +7,7 @@ import { URLObject, URLPath } from '@kubb/core/utils' export const templates = { ...QueryKey.templates, react: function({ name, typeName, params, generics, returnType, JSDoc }: React.ComponentProps) { - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const path = new URLPath(operation.path) const withQueryParams = !!schemas.queryParams?.name diff --git a/examples/react-query/src/gen/models/AddPet.ts b/examples/react-query/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/react-query/src/gen/models/AddPet.ts +++ b/examples/react-query/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/react-query/src/gen/models/CreateUser.ts b/examples/react-query/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/react-query/src/gen/models/CreateUser.ts +++ b/examples/react-query/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/react-query/src/gen/models/DeleteOrder.ts b/examples/react-query/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/react-query/src/gen/models/DeleteOrder.ts +++ b/examples/react-query/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/react-query/src/gen/models/DeletePet.ts b/examples/react-query/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/react-query/src/gen/models/DeletePet.ts +++ b/examples/react-query/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/react-query/src/gen/models/DeleteUser.ts b/examples/react-query/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/react-query/src/gen/models/DeleteUser.ts +++ b/examples/react-query/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/react-query/src/gen/models/FindPetsByStatus.ts b/examples/react-query/src/gen/models/FindPetsByStatus.ts index 5a03a4dae..adab08cd0 100644 --- a/examples/react-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/react-query/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/react-query/src/gen/models/FindPetsByTags.ts b/examples/react-query/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/react-query/src/gen/models/FindPetsByTags.ts +++ b/examples/react-query/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/react-query/src/gen/models/GetInventory.ts b/examples/react-query/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/react-query/src/gen/models/GetInventory.ts +++ b/examples/react-query/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/react-query/src/gen/models/GetOrderById.ts b/examples/react-query/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/react-query/src/gen/models/GetOrderById.ts +++ b/examples/react-query/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/react-query/src/gen/models/GetPetById.ts b/examples/react-query/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/react-query/src/gen/models/GetPetById.ts +++ b/examples/react-query/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/react-query/src/gen/models/GetUserByName.ts b/examples/react-query/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/react-query/src/gen/models/GetUserByName.ts +++ b/examples/react-query/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/react-query/src/gen/models/LoginUser.ts b/examples/react-query/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/react-query/src/gen/models/LoginUser.ts +++ b/examples/react-query/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/react-query/src/gen/models/LogoutUser.ts b/examples/react-query/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/react-query/src/gen/models/LogoutUser.ts +++ b/examples/react-query/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/react-query/src/gen/models/PlaceOrder.ts b/examples/react-query/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/react-query/src/gen/models/PlaceOrder.ts +++ b/examples/react-query/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/react-query/src/gen/models/PlaceOrderPatch.ts b/examples/react-query/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/react-query/src/gen/models/PlaceOrderPatch.ts +++ b/examples/react-query/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/react-query/src/gen/models/UpdatePet.ts b/examples/react-query/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/react-query/src/gen/models/UpdatePet.ts +++ b/examples/react-query/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/react-query/src/gen/models/UpdatePetWithForm.ts b/examples/react-query/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/react-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/react-query/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/react-query/src/gen/models/UpdateUser.ts b/examples/react-query/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/react-query/src/gen/models/UpdateUser.ts +++ b/examples/react-query/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/react-query/src/gen/models/UploadFile.ts b/examples/react-query/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/react-query/src/gen/models/UploadFile.ts +++ b/examples/react-query/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/simple-single/src/gen/models.ts b/examples/simple-single/src/gen/models.ts index f50e37f69..7041c7a7c 100644 --- a/examples/simple-single/src/gen/models.ts +++ b/examples/simple-single/src/gen/models.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export const orderStatus = { 'placed': 'placed', 'approved': 'approved', @@ -88,18 +43,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -146,7 +124,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -154,22 +132,16 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export const addPetRequestStatus = { +export const petStatus = { 'available': 'available', 'pending': 'pending', 'sold': 'sold', } as const -export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] -export type AddPetRequest = { +export type PetStatus = (typeof petStatus)[keyof typeof petStatus] +export type Pet = { /** * @type integer | undefined int64 */ @@ -191,16 +163,16 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export const petStatus = { +export const addPetRequestStatus = { 'available': 'available', 'pending': 'pending', 'sold': 'sold', } as const -export type PetStatus = (typeof petStatus)[keyof typeof petStatus] -export type Pet = { +export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -222,9 +194,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string } +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string +} + +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -245,21 +255,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -276,31 +287,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { 'available': 'available', 'pending': 'pending', @@ -320,21 +312,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -358,26 +351,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -391,19 +380,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -424,6 +422,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -431,10 +437,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -445,13 +454,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -459,18 +466,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -486,6 +481,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -496,20 +504,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -520,18 +536,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -542,18 +559,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -569,23 +593,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -597,32 +619,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -631,33 +645,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -676,22 +681,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -707,48 +737,47 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any +export type UpdateUserMutation = { + Response: UpdateUserMutationResponse + Request: UpdateUserMutationRequest + PathParams: UpdateUserPathParams +} -export type UpdateUserPathParams = { +export type DeleteUserPathParams = { /** - * @description name that need to be deleted + * @description The name that needs to be deleted * @type string */ username: string } -export type UpdateUserMutation = { - Response: UpdateUserMutationResponse - Request: UpdateUserMutationRequest - PathParams: UpdateUserPathParams -} + +export type DeleteUserMutationResponse = any /** * @description Invalid username supplied @@ -760,15 +789,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/solid-query/src/gen/models/AddPet.ts b/examples/solid-query/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/solid-query/src/gen/models/AddPet.ts +++ b/examples/solid-query/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/solid-query/src/gen/models/CreateUser.ts b/examples/solid-query/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/solid-query/src/gen/models/CreateUser.ts +++ b/examples/solid-query/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts b/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/solid-query/src/gen/models/DeleteOrder.ts b/examples/solid-query/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/solid-query/src/gen/models/DeleteOrder.ts +++ b/examples/solid-query/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/solid-query/src/gen/models/DeletePet.ts b/examples/solid-query/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/solid-query/src/gen/models/DeletePet.ts +++ b/examples/solid-query/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/solid-query/src/gen/models/DeleteUser.ts b/examples/solid-query/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/solid-query/src/gen/models/DeleteUser.ts +++ b/examples/solid-query/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/solid-query/src/gen/models/FindPetsByStatus.ts b/examples/solid-query/src/gen/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/solid-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/solid-query/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/solid-query/src/gen/models/FindPetsByTags.ts b/examples/solid-query/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/solid-query/src/gen/models/FindPetsByTags.ts +++ b/examples/solid-query/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/solid-query/src/gen/models/GetInventory.ts b/examples/solid-query/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/solid-query/src/gen/models/GetInventory.ts +++ b/examples/solid-query/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/solid-query/src/gen/models/GetOrderById.ts b/examples/solid-query/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/solid-query/src/gen/models/GetOrderById.ts +++ b/examples/solid-query/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/solid-query/src/gen/models/GetPetById.ts b/examples/solid-query/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/solid-query/src/gen/models/GetPetById.ts +++ b/examples/solid-query/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/solid-query/src/gen/models/GetUserByName.ts b/examples/solid-query/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/solid-query/src/gen/models/GetUserByName.ts +++ b/examples/solid-query/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/solid-query/src/gen/models/LoginUser.ts b/examples/solid-query/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/solid-query/src/gen/models/LoginUser.ts +++ b/examples/solid-query/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/solid-query/src/gen/models/LogoutUser.ts b/examples/solid-query/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/solid-query/src/gen/models/LogoutUser.ts +++ b/examples/solid-query/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/solid-query/src/gen/models/PlaceOrder.ts b/examples/solid-query/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/solid-query/src/gen/models/PlaceOrder.ts +++ b/examples/solid-query/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/solid-query/src/gen/models/PlaceOrderPatch.ts b/examples/solid-query/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/solid-query/src/gen/models/PlaceOrderPatch.ts +++ b/examples/solid-query/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/solid-query/src/gen/models/UpdatePet.ts b/examples/solid-query/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/solid-query/src/gen/models/UpdatePet.ts +++ b/examples/solid-query/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/solid-query/src/gen/models/UpdatePetWithForm.ts b/examples/solid-query/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/solid-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/solid-query/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/solid-query/src/gen/models/UpdateUser.ts b/examples/solid-query/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/solid-query/src/gen/models/UpdateUser.ts +++ b/examples/solid-query/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/solid-query/src/gen/models/UploadFile.ts b/examples/solid-query/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/solid-query/src/gen/models/UploadFile.ts +++ b/examples/solid-query/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/svelte-query/src/gen/models/AddPet.ts b/examples/svelte-query/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/svelte-query/src/gen/models/AddPet.ts +++ b/examples/svelte-query/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/svelte-query/src/gen/models/CreateUser.ts b/examples/svelte-query/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/svelte-query/src/gen/models/CreateUser.ts +++ b/examples/svelte-query/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts b/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/svelte-query/src/gen/models/DeleteOrder.ts b/examples/svelte-query/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/svelte-query/src/gen/models/DeleteOrder.ts +++ b/examples/svelte-query/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/svelte-query/src/gen/models/DeletePet.ts b/examples/svelte-query/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/svelte-query/src/gen/models/DeletePet.ts +++ b/examples/svelte-query/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/svelte-query/src/gen/models/DeleteUser.ts b/examples/svelte-query/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/svelte-query/src/gen/models/DeleteUser.ts +++ b/examples/svelte-query/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/svelte-query/src/gen/models/FindPetsByStatus.ts b/examples/svelte-query/src/gen/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/svelte-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/svelte-query/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/svelte-query/src/gen/models/FindPetsByTags.ts b/examples/svelte-query/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/svelte-query/src/gen/models/FindPetsByTags.ts +++ b/examples/svelte-query/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/svelte-query/src/gen/models/GetInventory.ts b/examples/svelte-query/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/svelte-query/src/gen/models/GetInventory.ts +++ b/examples/svelte-query/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/svelte-query/src/gen/models/GetOrderById.ts b/examples/svelte-query/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/svelte-query/src/gen/models/GetOrderById.ts +++ b/examples/svelte-query/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/svelte-query/src/gen/models/GetPetById.ts b/examples/svelte-query/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/svelte-query/src/gen/models/GetPetById.ts +++ b/examples/svelte-query/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/svelte-query/src/gen/models/GetUserByName.ts b/examples/svelte-query/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/svelte-query/src/gen/models/GetUserByName.ts +++ b/examples/svelte-query/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/svelte-query/src/gen/models/LoginUser.ts b/examples/svelte-query/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/svelte-query/src/gen/models/LoginUser.ts +++ b/examples/svelte-query/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/svelte-query/src/gen/models/LogoutUser.ts b/examples/svelte-query/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/svelte-query/src/gen/models/LogoutUser.ts +++ b/examples/svelte-query/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/svelte-query/src/gen/models/PlaceOrder.ts b/examples/svelte-query/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/svelte-query/src/gen/models/PlaceOrder.ts +++ b/examples/svelte-query/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/svelte-query/src/gen/models/PlaceOrderPatch.ts b/examples/svelte-query/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/svelte-query/src/gen/models/PlaceOrderPatch.ts +++ b/examples/svelte-query/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/svelte-query/src/gen/models/UpdatePet.ts b/examples/svelte-query/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/svelte-query/src/gen/models/UpdatePet.ts +++ b/examples/svelte-query/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts b/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/svelte-query/src/gen/models/UpdateUser.ts b/examples/svelte-query/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/svelte-query/src/gen/models/UpdateUser.ts +++ b/examples/svelte-query/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/svelte-query/src/gen/models/UploadFile.ts b/examples/svelte-query/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/svelte-query/src/gen/models/UploadFile.ts +++ b/examples/svelte-query/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/swr/src/gen/models/AddPet.ts b/examples/swr/src/gen/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/swr/src/gen/models/AddPet.ts +++ b/examples/swr/src/gen/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/swr/src/gen/models/CreateUser.ts b/examples/swr/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/swr/src/gen/models/CreateUser.ts +++ b/examples/swr/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/swr/src/gen/models/CreateUsersWithListInput.ts b/examples/swr/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/swr/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/swr/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/swr/src/gen/models/DeleteOrder.ts b/examples/swr/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/swr/src/gen/models/DeleteOrder.ts +++ b/examples/swr/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/swr/src/gen/models/DeletePet.ts b/examples/swr/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/swr/src/gen/models/DeletePet.ts +++ b/examples/swr/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/swr/src/gen/models/DeleteUser.ts b/examples/swr/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/swr/src/gen/models/DeleteUser.ts +++ b/examples/swr/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/swr/src/gen/models/FindPetsByStatus.ts b/examples/swr/src/gen/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/swr/src/gen/models/FindPetsByStatus.ts +++ b/examples/swr/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/swr/src/gen/models/FindPetsByTags.ts b/examples/swr/src/gen/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/swr/src/gen/models/FindPetsByTags.ts +++ b/examples/swr/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/swr/src/gen/models/GetInventory.ts b/examples/swr/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/swr/src/gen/models/GetInventory.ts +++ b/examples/swr/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/swr/src/gen/models/GetOrderById.ts b/examples/swr/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/swr/src/gen/models/GetOrderById.ts +++ b/examples/swr/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/swr/src/gen/models/GetPetById.ts b/examples/swr/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/swr/src/gen/models/GetPetById.ts +++ b/examples/swr/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/swr/src/gen/models/GetUserByName.ts b/examples/swr/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/swr/src/gen/models/GetUserByName.ts +++ b/examples/swr/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/swr/src/gen/models/LoginUser.ts b/examples/swr/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/swr/src/gen/models/LoginUser.ts +++ b/examples/swr/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/swr/src/gen/models/LogoutUser.ts b/examples/swr/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/swr/src/gen/models/LogoutUser.ts +++ b/examples/swr/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/swr/src/gen/models/PlaceOrder.ts b/examples/swr/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/swr/src/gen/models/PlaceOrder.ts +++ b/examples/swr/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/swr/src/gen/models/PlaceOrderPatch.ts b/examples/swr/src/gen/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/swr/src/gen/models/PlaceOrderPatch.ts +++ b/examples/swr/src/gen/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/swr/src/gen/models/UpdatePet.ts b/examples/swr/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/swr/src/gen/models/UpdatePet.ts +++ b/examples/swr/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/swr/src/gen/models/UpdatePetWithForm.ts b/examples/swr/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/swr/src/gen/models/UpdatePetWithForm.ts +++ b/examples/swr/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/swr/src/gen/models/UpdateUser.ts b/examples/swr/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/swr/src/gen/models/UpdateUser.ts +++ b/examples/swr/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/swr/src/gen/models/UploadFile.ts b/examples/swr/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/swr/src/gen/models/UploadFile.ts +++ b/examples/swr/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/typescript/src/gen/models.ts b/examples/typescript/src/gen/models.ts index 92c87622d..6664dc6a8 100644 --- a/examples/typescript/src/gen/models.ts +++ b/examples/typescript/src/gen/models.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export enum OrderStatus { 'placed' = 'placed', 'approved' = 'approved', @@ -86,18 +41,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -144,7 +122,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -152,21 +130,15 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export enum AddPetRequestStatus { +export enum PetStatus { 'available' = 'available', 'pending' = 'pending', 'sold' = 'sold', } -export type AddPetRequest = { +export type Pet = { /** * @type integer | undefined int64 */ @@ -188,15 +160,15 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export enum PetStatus { +export enum AddPetRequestStatus { 'available' = 'available', 'pending' = 'pending', 'sold' = 'sold', } -export type Pet = { +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -218,9 +190,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} + +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string } +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -241,21 +251,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -272,31 +283,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export enum FindPetsByStatusQueryParamsStatus { 'available' = 'available', 'pending' = 'pending', @@ -315,21 +307,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -353,26 +346,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -386,19 +375,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -419,6 +417,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -426,10 +432,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -440,13 +449,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -454,18 +461,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -481,6 +476,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -491,20 +499,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -515,18 +531,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -537,18 +554,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -564,23 +588,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -592,32 +614,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -626,33 +640,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -671,22 +676,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -702,49 +732,48 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams } +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -755,15 +784,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/modelsConst.ts b/examples/typescript/src/gen/modelsConst.ts index 1a7b01bc5..b2affe7f5 100644 --- a/examples/typescript/src/gen/modelsConst.ts +++ b/examples/typescript/src/gen/modelsConst.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export const orderStatus = { placed: 'placed', approved: 'approved', @@ -88,18 +43,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -146,7 +124,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -154,22 +132,16 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export const addPetRequestStatus = { +export const petStatus = { available: 'available', pending: 'pending', sold: 'sold', } as const -export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] -export type AddPetRequest = { +export type PetStatus = (typeof petStatus)[keyof typeof petStatus] +export type Pet = { /** * @type integer | undefined int64 */ @@ -191,16 +163,16 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export const petStatus = { +export const addPetRequestStatus = { available: 'available', pending: 'pending', sold: 'sold', } as const -export type PetStatus = (typeof petStatus)[keyof typeof petStatus] -export type Pet = { +export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -222,9 +194,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} + +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string } +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -245,21 +255,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -276,31 +287,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -320,21 +312,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -358,26 +351,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -391,19 +380,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -424,6 +422,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -431,10 +437,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -445,13 +454,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -459,18 +466,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -486,6 +481,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -496,20 +504,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -520,18 +536,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -542,18 +559,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -569,23 +593,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -597,32 +619,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -631,33 +645,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -676,22 +681,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -707,49 +737,48 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams } +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -760,15 +789,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/modelsConstEnum.ts b/examples/typescript/src/gen/modelsConstEnum.ts index d8a2a7778..a976d75bb 100644 --- a/examples/typescript/src/gen/modelsConstEnum.ts +++ b/examples/typescript/src/gen/modelsConstEnum.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export const enum OrderStatus { 'placed' = 'placed', 'approved' = 'approved', @@ -86,18 +41,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -144,7 +122,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -152,21 +130,15 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export const enum AddPetRequestStatus { +export const enum PetStatus { 'available' = 'available', 'pending' = 'pending', 'sold' = 'sold', } -export type AddPetRequest = { +export type Pet = { /** * @type integer | undefined int64 */ @@ -188,15 +160,15 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export const enum PetStatus { +export const enum AddPetRequestStatus { 'available' = 'available', 'pending' = 'pending', 'sold' = 'sold', } -export type Pet = { +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -218,9 +190,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} + +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string } +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -241,21 +251,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -272,31 +283,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const enum FindPetsByStatusQueryParamsStatus { 'available' = 'available', 'pending' = 'pending', @@ -315,21 +307,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -353,26 +346,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -386,19 +375,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -419,6 +417,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -426,10 +432,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -440,13 +449,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -454,18 +461,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -481,6 +476,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -491,20 +499,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -515,18 +531,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -537,18 +554,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -564,23 +588,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -592,32 +614,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -626,33 +640,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -671,22 +676,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -702,49 +732,48 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams } +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -755,15 +784,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/modelsLiteral.ts b/examples/typescript/src/gen/modelsLiteral.ts index 63c1ba800..74d342f0e 100644 --- a/examples/typescript/src/gen/modelsLiteral.ts +++ b/examples/typescript/src/gen/modelsLiteral.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export type OrderStatus = 'placed' | 'approved' | 'delivered' export type OrderHttpStatus = 200 | 400 | 500 export type Order = { @@ -78,18 +33,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -136,7 +114,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -144,17 +122,11 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export type AddPetRequestStatus = 'available' | 'pending' | 'sold' -export type AddPetRequest = { +export type PetStatus = 'available' | 'pending' | 'sold' +export type Pet = { /** * @type integer | undefined int64 */ @@ -176,11 +148,11 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export type PetStatus = 'available' | 'pending' | 'sold' -export type Pet = { +export type AddPetRequestStatus = 'available' | 'pending' | 'sold' +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -202,9 +174,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} + +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string } +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -225,21 +235,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -256,31 +267,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export type FindPetsByStatusQueryParamsStatus = 'available' | 'pending' | 'sold' export type FindPetsByStatusQueryParams = { /** @@ -295,21 +287,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -333,26 +326,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -366,19 +355,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -399,6 +397,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -406,10 +412,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -420,13 +429,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -434,18 +441,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -461,6 +456,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -471,20 +479,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -495,18 +511,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -517,18 +534,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -544,23 +568,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -572,32 +594,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -606,33 +620,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -651,22 +656,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -682,49 +712,48 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams } +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -735,15 +764,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/modelsPascalConst.ts b/examples/typescript/src/gen/modelsPascalConst.ts index 0f2e8f57d..37546351d 100644 --- a/examples/typescript/src/gen/modelsPascalConst.ts +++ b/examples/typescript/src/gen/modelsPascalConst.ts @@ -1,48 +1,3 @@ -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} - -export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} - -export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} - export const OrderStatus = { placed: 'placed', approved: 'approved', @@ -88,18 +43,41 @@ export type Order = { complete?: boolean } -export type PetNotFound = { +export type Customer = { /** - * @type integer | undefined int32 + * @type integer | undefined int64 */ - code?: number + id?: number /** * @type string | undefined */ - message?: string + username?: string + /** + * @type array | undefined + */ + address?: Address[] } -export type Tag = { +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} + +export type Category = { /** * @type integer | undefined int64 */ @@ -146,7 +124,7 @@ export type User = { userStatus?: number } -export type Customer = { +export type Tag = { /** * @type integer | undefined int64 */ @@ -154,22 +132,16 @@ export type Customer = { /** * @type string | undefined */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] + name?: string } -export type UserArray = User[] - -export const AddPetRequestStatus = { +export const PetStatus = { available: 'available', pending: 'pending', sold: 'sold', } as const -export type AddPetRequestStatus = (typeof AddPetRequestStatus)[keyof typeof AddPetRequestStatus] -export type AddPetRequest = { +export type PetStatus = (typeof PetStatus)[keyof typeof PetStatus] +export type Pet = { /** * @type integer | undefined int64 */ @@ -191,16 +163,16 @@ export type AddPetRequest = { * @description pet status in the store * @type string | undefined */ - status?: AddPetRequestStatus + status?: PetStatus } -export const PetStatus = { +export const AddPetRequestStatus = { available: 'available', pending: 'pending', sold: 'sold', } as const -export type PetStatus = (typeof PetStatus)[keyof typeof PetStatus] -export type Pet = { +export type AddPetRequestStatus = (typeof AddPetRequestStatus)[keyof typeof AddPetRequestStatus] +export type AddPetRequest = { /** * @type integer | undefined int64 */ @@ -222,9 +194,47 @@ export type Pet = { * @description pet status in the store * @type string | undefined */ - status?: PetStatus + status?: AddPetRequestStatus +} + +export type ApiResponse = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} + +export type PetNotFound = { + /** + * @type integer | undefined int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string } +export type UserArray = User[] + +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -245,21 +255,22 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 } +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -276,31 +287,12 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest Errors: AddPet405 } -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const FindPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -320,21 +312,22 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} /** * @description successful operation */ -export type FindPetsByTags200 = Pet[] +export type FindPetsByStatus200 = Pet[] /** - * @description Invalid tag value + * @description Invalid status value */ -export type FindPetsByTags400 = any +export type FindPetsByStatus400 = any + +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} export type FindPetsByTagsQueryParams = { /** @@ -358,26 +351,22 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} /** * @description successful operation */ -export type GetPetById200 = Pet +export type FindPetsByTags200 = Pet[] /** - * @description Invalid ID supplied + * @description Invalid tag value */ -export type GetPetById400 = any +export type FindPetsByTags400 = any -/** - * @description Pet not found - */ -export type GetPetById404 = any +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} export type GetPetByIdPathParams = { /** @@ -391,19 +380,28 @@ export type GetPetByIdPathParams = { * @description successful operation */ export type GetPetByIdQueryResponse = Pet + +/** + * @description successful operation + */ +export type GetPetById200 = Pet + +/** + * @description Invalid ID supplied + */ +export type GetPetById400 = any + +/** + * @description Pet not found + */ +export type GetPetById404 = any + export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams Errors: GetPetById400 | GetPetById404 } -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -424,6 +422,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams @@ -431,10 +437,13 @@ export type UpdatePetWithFormMutation = { Errors: UpdatePetWithForm405 } -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -445,13 +454,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams @@ -459,18 +466,6 @@ export type DeletePetMutation = { Errors: DeletePet400 } -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -486,6 +481,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest @@ -496,20 +504,28 @@ export type UploadFileMutation = { /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -520,18 +536,19 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest Errors: PlaceOrder405 } +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -542,18 +559,25 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest Errors: PlaceOrderPatch405 } +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -569,23 +593,21 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} + +export type DeleteOrderPathParams = { /** - * @description ID of order that needs to be fetched + * @description ID of the order that needs to be deleted * @type integer int64 */ orderId: number } -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} +export type DeleteOrderMutationResponse = any /** * @description Invalid ID supplied @@ -597,32 +619,24 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams Errors: DeleteOrder400 | DeleteOrder404 } -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest @@ -631,33 +645,24 @@ export type CreateUserMutation = { /** * @description Successful operation */ -export type CreateUsersWithListInput200 = User - -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any +export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutationRequest = User[] /** * @description Successful operation */ -export type CreateUsersWithListInputMutationResponse = User -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} +export type CreateUsersWithListInput200 = User /** * @description successful operation */ -export type LoginUser200 = string +export type CreateUsersWithListInputError = any -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} export type LoginUserQueryParams = { /** @@ -676,22 +681,47 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams Errors: LoginUser400 } +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -707,49 +737,48 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} + +export type UpdateUserPathParams = { /** - * @description The name that needs to be fetched. Use user1 for testing. + * @description name that need to be deleted * @type string */ username: string } +export type UpdateUserMutationResponse = any + /** - * @description successful operation + * @description Update an existent user in the store */ -export type GetUserByNameQueryResponse = User -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} +export type UpdateUserMutationRequest = User /** * @description successful operation */ export type UpdateUserError = any -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams } +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -760,15 +789,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/ts/models/AddPet.ts b/examples/typescript/src/gen/ts/models/AddPet.ts index 3da4ad8ea..e0fa28de7 100644 --- a/examples/typescript/src/gen/ts/models/AddPet.ts +++ b/examples/typescript/src/gen/ts/models/AddPet.ts @@ -1,6 +1,16 @@ import type { Pet } from './Pet' import type { AddPetRequest } from './AddPetRequest' +/** + * @description Successful operation + */ +export type AddPetMutationResponse = Pet + +/** + * @description Create a new pet in the store + */ +export type AddPetMutationRequest = AddPetRequest + /** * @description Successful operation */ @@ -17,15 +27,6 @@ export type AddPet405 = { message?: string } -/** - * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest - -/** - * @description Successful operation - */ -export type AddPetMutationResponse = Pet export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/typescript/src/gen/ts/models/CreateUser.ts b/examples/typescript/src/gen/ts/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/typescript/src/gen/ts/models/CreateUser.ts +++ b/examples/typescript/src/gen/ts/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts b/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts +++ b/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/typescript/src/gen/ts/models/DeleteOrder.ts b/examples/typescript/src/gen/ts/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/typescript/src/gen/ts/models/DeleteOrder.ts +++ b/examples/typescript/src/gen/ts/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/typescript/src/gen/ts/models/DeletePet.ts b/examples/typescript/src/gen/ts/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/typescript/src/gen/ts/models/DeletePet.ts +++ b/examples/typescript/src/gen/ts/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/typescript/src/gen/ts/models/DeleteUser.ts b/examples/typescript/src/gen/ts/models/DeleteUser.ts index dec8d2800..f5e17e644 100644 --- a/examples/typescript/src/gen/ts/models/DeleteUser.ts +++ b/examples/typescript/src/gen/ts/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string | null +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string | null -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/typescript/src/gen/ts/models/FindPetsByStatus.ts b/examples/typescript/src/gen/ts/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/typescript/src/gen/ts/models/FindPetsByStatus.ts +++ b/examples/typescript/src/gen/ts/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/typescript/src/gen/ts/models/FindPetsByTags.ts b/examples/typescript/src/gen/ts/models/FindPetsByTags.ts index bfc16d420..ce616515e 100644 --- a/examples/typescript/src/gen/ts/models/FindPetsByTags.ts +++ b/examples/typescript/src/gen/ts/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -32,6 +22,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/typescript/src/gen/ts/models/GetInventory.ts b/examples/typescript/src/gen/ts/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/typescript/src/gen/ts/models/GetInventory.ts +++ b/examples/typescript/src/gen/ts/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/typescript/src/gen/ts/models/GetOrderById.ts b/examples/typescript/src/gen/ts/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/typescript/src/gen/ts/models/GetOrderById.ts +++ b/examples/typescript/src/gen/ts/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/typescript/src/gen/ts/models/GetPetById.ts b/examples/typescript/src/gen/ts/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/typescript/src/gen/ts/models/GetPetById.ts +++ b/examples/typescript/src/gen/ts/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/typescript/src/gen/ts/models/GetUserByName.ts b/examples/typescript/src/gen/ts/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/typescript/src/gen/ts/models/GetUserByName.ts +++ b/examples/typescript/src/gen/ts/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/typescript/src/gen/ts/models/LoginUser.ts b/examples/typescript/src/gen/ts/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/typescript/src/gen/ts/models/LoginUser.ts +++ b/examples/typescript/src/gen/ts/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/typescript/src/gen/ts/models/LogoutUser.ts b/examples/typescript/src/gen/ts/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/typescript/src/gen/ts/models/LogoutUser.ts +++ b/examples/typescript/src/gen/ts/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/typescript/src/gen/ts/models/PlaceOrder.ts b/examples/typescript/src/gen/ts/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/typescript/src/gen/ts/models/PlaceOrder.ts +++ b/examples/typescript/src/gen/ts/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/typescript/src/gen/ts/models/PlaceOrderPatch.ts b/examples/typescript/src/gen/ts/models/PlaceOrderPatch.ts index 224fdac37..a5d17bdeb 100644 --- a/examples/typescript/src/gen/ts/models/PlaceOrderPatch.ts +++ b/examples/typescript/src/gen/ts/models/PlaceOrderPatch.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderPatchMutationResponse = Order + +export type PlaceOrderPatchMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrderPatch200 = Order */ export type PlaceOrderPatch405 = any -export type PlaceOrderPatchMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order export type PlaceOrderPatchMutation = { Response: PlaceOrderPatchMutationResponse Request: PlaceOrderPatchMutationRequest diff --git a/examples/typescript/src/gen/ts/models/UpdatePet.ts b/examples/typescript/src/gen/ts/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/typescript/src/gen/ts/models/UpdatePet.ts +++ b/examples/typescript/src/gen/ts/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts b/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts +++ b/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/typescript/src/gen/ts/models/UpdateUser.ts b/examples/typescript/src/gen/ts/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/typescript/src/gen/ts/models/UpdateUser.ts +++ b/examples/typescript/src/gen/ts/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/typescript/src/gen/ts/models/UploadFile.ts b/examples/typescript/src/gen/ts/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/typescript/src/gen/ts/models/UploadFile.ts +++ b/examples/typescript/src/gen/ts/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/AddPet.ts b/examples/vue-query-v5/src/gen/models/AddPet.ts index 74a2fcc26..ed8b3ea9d 100644 --- a/examples/vue-query-v5/src/gen/models/AddPet.ts +++ b/examples/vue-query-v5/src/gen/models/AddPet.ts @@ -3,12 +3,7 @@ import type { Pet } from './Pet' /** * @description Successful operation */ -export type AddPet200 = Pet - -/** - * @description Invalid input - */ -export type AddPet405 = any +export type AddPetMutationResponse = Pet /** * @description Create a new pet in the store @@ -18,7 +13,13 @@ export type AddPetMutationRequest = Pet /** * @description Successful operation */ -export type AddPetMutationResponse = Pet +export type AddPet200 = Pet + +/** + * @description Invalid input + */ +export type AddPet405 = any + export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/CreateUser.ts b/examples/vue-query-v5/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUser.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/DeleteOrder.ts b/examples/vue-query-v5/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/vue-query-v5/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query-v5/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/vue-query-v5/src/gen/models/DeletePet.ts b/examples/vue-query-v5/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/vue-query-v5/src/gen/models/DeletePet.ts +++ b/examples/vue-query-v5/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/vue-query-v5/src/gen/models/DeleteUser.ts b/examples/vue-query-v5/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/vue-query-v5/src/gen/models/DeleteUser.ts +++ b/examples/vue-query-v5/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts b/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts +++ b/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts b/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts index d9a5b883d..5a6878fb8 100644 --- a/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts +++ b/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -22,6 +12,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/vue-query-v5/src/gen/models/GetInventory.ts b/examples/vue-query-v5/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/vue-query-v5/src/gen/models/GetInventory.ts +++ b/examples/vue-query-v5/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/vue-query-v5/src/gen/models/GetOrderById.ts b/examples/vue-query-v5/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/vue-query-v5/src/gen/models/GetOrderById.ts +++ b/examples/vue-query-v5/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/vue-query-v5/src/gen/models/GetPetById.ts b/examples/vue-query-v5/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/vue-query-v5/src/gen/models/GetPetById.ts +++ b/examples/vue-query-v5/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/vue-query-v5/src/gen/models/GetUserByName.ts b/examples/vue-query-v5/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/vue-query-v5/src/gen/models/GetUserByName.ts +++ b/examples/vue-query-v5/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/vue-query-v5/src/gen/models/LoginUser.ts b/examples/vue-query-v5/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/vue-query-v5/src/gen/models/LoginUser.ts +++ b/examples/vue-query-v5/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/vue-query-v5/src/gen/models/LogoutUser.ts b/examples/vue-query-v5/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/vue-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/vue-query-v5/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/vue-query-v5/src/gen/models/PlaceOrder.ts b/examples/vue-query-v5/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/vue-query-v5/src/gen/models/PlaceOrder.ts +++ b/examples/vue-query-v5/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/UpdatePet.ts b/examples/vue-query-v5/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/vue-query-v5/src/gen/models/UpdatePet.ts +++ b/examples/vue-query-v5/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/vue-query-v5/src/gen/models/UpdateUser.ts b/examples/vue-query-v5/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/vue-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/vue-query-v5/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/vue-query-v5/src/gen/models/UploadFile.ts b/examples/vue-query-v5/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/vue-query-v5/src/gen/models/UploadFile.ts +++ b/examples/vue-query-v5/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/vue-query/src/gen/models/AddPet.ts b/examples/vue-query/src/gen/models/AddPet.ts index 74a2fcc26..ed8b3ea9d 100644 --- a/examples/vue-query/src/gen/models/AddPet.ts +++ b/examples/vue-query/src/gen/models/AddPet.ts @@ -3,12 +3,7 @@ import type { Pet } from './Pet' /** * @description Successful operation */ -export type AddPet200 = Pet - -/** - * @description Invalid input - */ -export type AddPet405 = any +export type AddPetMutationResponse = Pet /** * @description Create a new pet in the store @@ -18,7 +13,13 @@ export type AddPetMutationRequest = Pet /** * @description Successful operation */ -export type AddPetMutationResponse = Pet +export type AddPet200 = Pet + +/** + * @description Invalid input + */ +export type AddPet405 = any + export type AddPetMutation = { Response: AddPetMutationResponse Request: AddPetMutationRequest diff --git a/examples/vue-query/src/gen/models/CreateUser.ts b/examples/vue-query/src/gen/models/CreateUser.ts index bebe12c9c..7c6ac6d46 100644 --- a/examples/vue-query/src/gen/models/CreateUser.ts +++ b/examples/vue-query/src/gen/models/CreateUser.ts @@ -1,16 +1,17 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUserError = User +export type CreateUserMutationResponse = any /** * @description Created user object */ export type CreateUserMutationRequest = User -export type CreateUserMutationResponse = any +/** + * @description successful operation + */ +export type CreateUserError = User + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts index c60e1e02f..3e69b1dad 100644 --- a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,5 +1,12 @@ import type { User } from './User' +/** + * @description Successful operation + */ +export type CreateUsersWithListInputMutationResponse = User + +export type CreateUsersWithListInputMutationRequest = User[] + /** * @description Successful operation */ @@ -10,12 +17,6 @@ export type CreateUsersWithListInput200 = User */ export type CreateUsersWithListInputError = any -export type CreateUsersWithListInputMutationRequest = User[] - -/** - * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest diff --git a/examples/vue-query/src/gen/models/DeleteOrder.ts b/examples/vue-query/src/gen/models/DeleteOrder.ts index 26edce6d7..e510b5eaf 100644 --- a/examples/vue-query/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query/src/gen/models/DeleteOrder.ts @@ -1,3 +1,13 @@ +export type DeleteOrderPathParams = { + /** + * @description ID of the order that needs to be deleted + * @type integer int64 + */ + orderId: number +} + +export type DeleteOrderMutationResponse = any + /** * @description Invalid ID supplied */ @@ -8,15 +18,6 @@ export type DeleteOrder400 = any */ export type DeleteOrder404 = any -export type DeleteOrderMutationResponse = any - -export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} export type DeleteOrderMutation = { Response: DeleteOrderMutationResponse PathParams: DeleteOrderPathParams diff --git a/examples/vue-query/src/gen/models/DeletePet.ts b/examples/vue-query/src/gen/models/DeletePet.ts index 3e09deba9..00daef040 100644 --- a/examples/vue-query/src/gen/models/DeletePet.ts +++ b/examples/vue-query/src/gen/models/DeletePet.ts @@ -1,7 +1,10 @@ -/** - * @description Invalid pet value - */ -export type DeletePet400 = any +export type DeletePetPathParams = { + /** + * @description Pet id to delete + * @type integer int64 + */ + petId: number +} export type DeletePetHeaderParams = { /** @@ -12,13 +15,11 @@ export type DeletePetHeaderParams = { export type DeletePetMutationResponse = any -export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} +/** + * @description Invalid pet value + */ +export type DeletePet400 = any + export type DeletePetMutation = { Response: DeletePetMutationResponse PathParams: DeletePetPathParams diff --git a/examples/vue-query/src/gen/models/DeleteUser.ts b/examples/vue-query/src/gen/models/DeleteUser.ts index 4616f1f9f..3bb074727 100644 --- a/examples/vue-query/src/gen/models/DeleteUser.ts +++ b/examples/vue-query/src/gen/models/DeleteUser.ts @@ -1,3 +1,13 @@ +export type DeleteUserPathParams = { + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} + +export type DeleteUserMutationResponse = any + /** * @description Invalid username supplied */ @@ -8,15 +18,6 @@ export type DeleteUser400 = any */ export type DeleteUser404 = any -export type DeleteUserMutationResponse = any - -export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} export type DeleteUserMutation = { Response: DeleteUserMutationResponse PathParams: DeleteUserPathParams diff --git a/examples/vue-query/src/gen/models/FindPetsByStatus.ts b/examples/vue-query/src/gen/models/FindPetsByStatus.ts index ebef87e18..6da7685b2 100644 --- a/examples/vue-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/vue-query/src/gen/models/FindPetsByStatus.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] - -/** - * @description Invalid status value - */ -export type FindPetsByStatus400 = any - export const findPetsByStatusQueryParamsStatus = { available: 'available', pending: 'pending', @@ -29,6 +19,17 @@ export type FindPetsByStatusQueryParams = { * @description successful operation */ export type FindPetsByStatusQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByStatus200 = Pet[] + +/** + * @description Invalid status value + */ +export type FindPetsByStatus400 = any + export type FindPetsByStatusQuery = { Response: FindPetsByStatusQueryResponse QueryParams: FindPetsByStatusQueryParams diff --git a/examples/vue-query/src/gen/models/FindPetsByTags.ts b/examples/vue-query/src/gen/models/FindPetsByTags.ts index d9a5b883d..5a6878fb8 100644 --- a/examples/vue-query/src/gen/models/FindPetsByTags.ts +++ b/examples/vue-query/src/gen/models/FindPetsByTags.ts @@ -1,15 +1,5 @@ import type { Pet } from './Pet' -/** - * @description successful operation - */ -export type FindPetsByTags200 = Pet[] - -/** - * @description Invalid tag value - */ -export type FindPetsByTags400 = any - export type FindPetsByTagsQueryParams = { /** * @description Tags to filter by @@ -22,6 +12,17 @@ export type FindPetsByTagsQueryParams = { * @description successful operation */ export type FindPetsByTagsQueryResponse = Pet[] + +/** + * @description successful operation + */ +export type FindPetsByTags200 = Pet[] + +/** + * @description Invalid tag value + */ +export type FindPetsByTags400 = any + export type FindPetsByTagsQuery = { Response: FindPetsByTagsQueryResponse QueryParams: FindPetsByTagsQueryParams diff --git a/examples/vue-query/src/gen/models/GetInventory.ts b/examples/vue-query/src/gen/models/GetInventory.ts index 727a142c9..a8a1486cb 100644 --- a/examples/vue-query/src/gen/models/GetInventory.ts +++ b/examples/vue-query/src/gen/models/GetInventory.ts @@ -1,16 +1,17 @@ /** * @description successful operation */ -export type GetInventory200 = { +export type GetInventoryQueryResponse = { [key: string]: number } /** * @description successful operation */ -export type GetInventoryQueryResponse = { +export type GetInventory200 = { [key: string]: number } + export type GetInventoryQuery = { Response: GetInventoryQueryResponse } diff --git a/examples/vue-query/src/gen/models/GetOrderById.ts b/examples/vue-query/src/gen/models/GetOrderById.ts index 4d2180864..29e2948f0 100644 --- a/examples/vue-query/src/gen/models/GetOrderById.ts +++ b/examples/vue-query/src/gen/models/GetOrderById.ts @@ -1,5 +1,18 @@ import type { Order } from './Order' +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer int64 + */ + orderId: number +} + +/** + * @description successful operation + */ +export type GetOrderByIdQueryResponse = Order + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetOrderById400 = any */ export type GetOrderById404 = any -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} - -/** - * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order export type GetOrderByIdQuery = { Response: GetOrderByIdQueryResponse PathParams: GetOrderByIdPathParams diff --git a/examples/vue-query/src/gen/models/GetPetById.ts b/examples/vue-query/src/gen/models/GetPetById.ts index bf229ba0f..62ea8459e 100644 --- a/examples/vue-query/src/gen/models/GetPetById.ts +++ b/examples/vue-query/src/gen/models/GetPetById.ts @@ -1,5 +1,18 @@ import type { Pet } from './Pet' +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer int64 + */ + petId: number +} + +/** + * @description successful operation + */ +export type GetPetByIdQueryResponse = Pet + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetPetById400 = any */ export type GetPetById404 = any -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} - -/** - * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet export type GetPetByIdQuery = { Response: GetPetByIdQueryResponse PathParams: GetPetByIdPathParams diff --git a/examples/vue-query/src/gen/models/GetUserByName.ts b/examples/vue-query/src/gen/models/GetUserByName.ts index ddecddc18..7cefa691f 100644 --- a/examples/vue-query/src/gen/models/GetUserByName.ts +++ b/examples/vue-query/src/gen/models/GetUserByName.ts @@ -1,5 +1,18 @@ import type { User } from './User' +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} + +/** + * @description successful operation + */ +export type GetUserByNameQueryResponse = User + /** * @description successful operation */ @@ -15,18 +28,6 @@ export type GetUserByName400 = any */ export type GetUserByName404 = any -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} - -/** - * @description successful operation - */ -export type GetUserByNameQueryResponse = User export type GetUserByNameQuery = { Response: GetUserByNameQueryResponse PathParams: GetUserByNamePathParams diff --git a/examples/vue-query/src/gen/models/LoginUser.ts b/examples/vue-query/src/gen/models/LoginUser.ts index 285f1f91f..89f38f0db 100644 --- a/examples/vue-query/src/gen/models/LoginUser.ts +++ b/examples/vue-query/src/gen/models/LoginUser.ts @@ -1,13 +1,3 @@ -/** - * @description successful operation - */ -export type LoginUser200 = string - -/** - * @description Invalid username/password supplied - */ -export type LoginUser400 = any - export type LoginUserQueryParams = { /** * @description The user name for login @@ -25,6 +15,17 @@ export type LoginUserQueryParams = { * @description successful operation */ export type LoginUserQueryResponse = string + +/** + * @description successful operation + */ +export type LoginUser200 = string + +/** + * @description Invalid username/password supplied + */ +export type LoginUser400 = any + export type LoginUserQuery = { Response: LoginUserQueryResponse QueryParams: LoginUserQueryParams diff --git a/examples/vue-query/src/gen/models/LogoutUser.ts b/examples/vue-query/src/gen/models/LogoutUser.ts index 72c41681a..ff906369e 100644 --- a/examples/vue-query/src/gen/models/LogoutUser.ts +++ b/examples/vue-query/src/gen/models/LogoutUser.ts @@ -1,9 +1,10 @@ +export type LogoutUserQueryResponse = any + /** * @description successful operation */ export type LogoutUserError = any -export type LogoutUserQueryResponse = any export type LogoutUserQuery = { Response: LogoutUserQueryResponse } diff --git a/examples/vue-query/src/gen/models/PlaceOrder.ts b/examples/vue-query/src/gen/models/PlaceOrder.ts index 8b1ae15dc..8e3051073 100644 --- a/examples/vue-query/src/gen/models/PlaceOrder.ts +++ b/examples/vue-query/src/gen/models/PlaceOrder.ts @@ -1,5 +1,12 @@ import type { Order } from './Order' +/** + * @description successful operation + */ +export type PlaceOrderMutationResponse = Order + +export type PlaceOrderMutationRequest = Order + /** * @description successful operation */ @@ -10,12 +17,6 @@ export type PlaceOrder200 = Order */ export type PlaceOrder405 = any -export type PlaceOrderMutationRequest = Order - -/** - * @description successful operation - */ -export type PlaceOrderMutationResponse = Order export type PlaceOrderMutation = { Response: PlaceOrderMutationResponse Request: PlaceOrderMutationRequest diff --git a/examples/vue-query/src/gen/models/UpdatePet.ts b/examples/vue-query/src/gen/models/UpdatePet.ts index 387ea365a..a565100c3 100644 --- a/examples/vue-query/src/gen/models/UpdatePet.ts +++ b/examples/vue-query/src/gen/models/UpdatePet.ts @@ -1,5 +1,15 @@ import type { Pet } from './Pet' +/** + * @description Successful operation + */ +export type UpdatePetMutationResponse = Pet + +/** + * @description Update an existent pet in the store + */ +export type UpdatePetMutationRequest = Pet + /** * @description Successful operation */ @@ -20,15 +30,6 @@ export type UpdatePet404 = any */ export type UpdatePet405 = any -/** - * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet - -/** - * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet export type UpdatePetMutation = { Response: UpdatePetMutationResponse Request: UpdatePetMutationRequest diff --git a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts index 1c55e58e6..9ffac6705 100644 --- a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts @@ -1,10 +1,3 @@ -/** - * @description Invalid input - */ -export type UpdatePetWithForm405 = any - -export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated @@ -25,6 +18,14 @@ export type UpdatePetWithFormQueryParams = { */ status?: string } + +export type UpdatePetWithFormMutationResponse = any + +/** + * @description Invalid input + */ +export type UpdatePetWithForm405 = any + export type UpdatePetWithFormMutation = { Response: UpdatePetWithFormMutationResponse PathParams: UpdatePetWithFormPathParams diff --git a/examples/vue-query/src/gen/models/UpdateUser.ts b/examples/vue-query/src/gen/models/UpdateUser.ts index 66394f648..4d7776ac7 100644 --- a/examples/vue-query/src/gen/models/UpdateUser.ts +++ b/examples/vue-query/src/gen/models/UpdateUser.ts @@ -1,17 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any - -/** - * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User - -export type UpdateUserMutationResponse = any - export type UpdateUserPathParams = { /** * @description name that need to be deleted @@ -19,6 +7,19 @@ export type UpdateUserPathParams = { */ username: string } + +export type UpdateUserMutationResponse = any + +/** + * @description Update an existent user in the store + */ +export type UpdateUserMutationRequest = User + +/** + * @description successful operation + */ +export type UpdateUserError = any + export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest diff --git a/examples/vue-query/src/gen/models/UploadFile.ts b/examples/vue-query/src/gen/models/UploadFile.ts index 4deff238e..f8a14ad9b 100644 --- a/examples/vue-query/src/gen/models/UploadFile.ts +++ b/examples/vue-query/src/gen/models/UploadFile.ts @@ -1,17 +1,5 @@ import type { ApiResponse } from './ApiResponse' -/** - * @description successful operation - */ -export type UploadFile200 = ApiResponse - -export type UploadFileMutationRequest = string - -/** - * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse - export type UploadFilePathParams = { /** * @description ID of pet to update @@ -27,6 +15,19 @@ export type UploadFileQueryParams = { */ additionalMetadata?: string } + +/** + * @description successful operation + */ +export type UploadFileMutationResponse = ApiResponse + +export type UploadFileMutationRequest = string + +/** + * @description successful operation + */ +export type UploadFile200 = ApiResponse + export type UploadFileMutation = { Response: UploadFileMutationResponse Request: UploadFileMutationRequest diff --git a/examples/zod/src/gen/ts/CreateUser.ts b/examples/zod/src/gen/ts/CreateUser.ts index 383dec24b..f73838734 100644 --- a/examples/zod/src/gen/ts/CreateUser.ts +++ b/examples/zod/src/gen/ts/CreateUser.ts @@ -10,7 +10,7 @@ export type CreateUser = { /** * @description OK */ -export type CreateUser201 = CreateUserResult +export type CreateUserMutationResponse = CreateUserResult export type CreateUserMutationRequest = { /** @@ -22,7 +22,8 @@ export type CreateUserMutationRequest = { /** * @description OK */ -export type CreateUserMutationResponse = CreateUserResult +export type CreateUser201 = CreateUserResult + export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest diff --git a/packages/swagger-client/src/OperationGenerator.test.tsx b/packages/swagger-client/src/OperationGenerator.test.tsx index 8496e4924..ec96c1b58 100644 --- a/packages/swagger-client/src/OperationGenerator.test.tsx +++ b/packages/swagger-client/src/OperationGenerator.test.tsx @@ -45,7 +45,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets/{pet_id}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -78,7 +78,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets/{pet_id}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -114,7 +114,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets/{pet_id}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() diff --git a/packages/swagger-client/src/OperationGenerator.tsx b/packages/swagger-client/src/OperationGenerator.tsx index ba1bbc1a7..27bcd4ea7 100644 --- a/packages/swagger-client/src/OperationGenerator.tsx +++ b/packages/swagger-client/src/OperationGenerator.tsx @@ -10,7 +10,7 @@ import type { Operation } from '@kubb/swagger/oas' import type { FileMeta, PluginOptions } from './types.ts' export class OperationGenerator extends Generator { - async all(operations: Operation[], operationsByMethod: OperationsByMethod): OperationMethodResult { + async all(operations: Operation[], _operationsByMethod: OperationsByMethod): OperationMethodResult { const { pluginManager, oas, plugin } = this.context const root = createRoot>({ logger: pluginManager.logger }) @@ -22,7 +22,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> {templates.operations && } , { meta: { pluginManager, plugin } }, @@ -31,7 +31,7 @@ export class OperationGenerator extends Generator { + async operation(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { const { oas, pluginManager, plugin } = this.context const root = createRoot>({ logger: pluginManager.logger }) @@ -47,7 +47,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> @@ -58,21 +58,21 @@ export class OperationGenerator extends Generator { - return this.#generate(operation, options) + async get(): OperationMethodResult { + return null } - async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async post(): OperationMethodResult { + return null } - async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async put(): OperationMethodResult { + return null } - async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async patch(): OperationMethodResult { + return null } - async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-client/src/components/Client.test.tsx b/packages/swagger-client/src/components/Client.test.tsx index c51810e81..21c13f94a 100644 --- a/packages/swagger-client/src/components/Client.test.tsx +++ b/packages/swagger-client/src/components/Client.test.tsx @@ -48,7 +48,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-client/src/components/Client.tsx b/packages/swagger-client/src/components/Client.tsx index 0fc4adf36..8ed5f6705 100644 --- a/packages/swagger-client/src/components/Client.tsx +++ b/packages/swagger-client/src/components/Client.tsx @@ -2,7 +2,7 @@ import transformers from '@kubb/core/transformers' import { FunctionParams } from '@kubb/core/utils' import { URLPath } from '@kubb/core/utils' import { Editor, File, Function, usePlugin } from '@kubb/react' -import { useGetOperationFile, useOperation, useOperationName, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOperation, useOperationName, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams, getComments, isRequired } from '@kubb/swagger/utils' import { pluginKey as swaggerTsPluginKey } from '@kubb/swagger-ts' @@ -83,7 +83,7 @@ type RootTemplateProps = { function RootTemplate({ children }: RootTemplateProps) { const { options: { client: { importPath } } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileType = useGetOperationFile({ pluginKey: swaggerTsPluginKey }) @@ -127,7 +127,7 @@ export function Client({ Template = defaultTemplates.default, }: ClientProps): KubbNode { const { options: { dataReturnType, pathParamsType } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const name = useOperationName({ type: 'function' }) diff --git a/packages/swagger-client/src/components/Operations.test.tsx b/packages/swagger-client/src/components/Operations.test.tsx index 7f0d8debb..6b650fe9a 100644 --- a/packages/swagger-client/src/components/Operations.test.tsx +++ b/packages/swagger-client/src/components/Operations.test.tsx @@ -49,7 +49,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-faker/src/FakerBuilder.ts b/packages/swagger-faker/src/FakerBuilder.ts index 5eb64567d..d4f8184f8 100644 --- a/packages/swagger-faker/src/FakerBuilder.ts +++ b/packages/swagger-faker/src/FakerBuilder.ts @@ -20,8 +20,9 @@ export class FakerBuilder extends OasBuilder { .filter((operationSchema) => (name ? operationSchema.name === name : true)) .sort(transformers.nameSorter) .map((operationSchema) => { - const generator = new FakerGenerator(this.options, this.context) - const sources = generator.build(operationSchema) + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const generator = new FakerGenerator(this.options, this.context as any) + const sources = generator.buildSource(operationSchema.name, operationSchema.schema, operationSchema) importMeta.push(...generator.imports) diff --git a/packages/swagger-faker/src/FakerGenerator.test.ts b/packages/swagger-faker/src/FakerGenerator.test.ts index e9e2dc6c7..46db4875a 100644 --- a/packages/swagger-faker/src/FakerGenerator.test.ts +++ b/packages/swagger-faker/src/FakerGenerator.test.ts @@ -6,7 +6,7 @@ import { OasManager } from '@kubb/swagger' import { FakerGenerator } from './FakerGenerator' import type { Plugin } from '@kubb/core' -import type { OasTypes } from '@kubb/swagger/oas' +import type { SchemaObject } from '@kubb/swagger/oas' import type { PluginOptions } from './types' describe('FakeGenerator enums', async () => { @@ -24,18 +24,20 @@ describe('FakeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas test('generate x-enum-varnames types', async () => { - const node = generator.build({ schema: schemas?.['enumVarNames.Type'] as OasTypes.SchemaObject, name: 'enumVarNames' }) + const node = generator.buildSource('enumVarNames', schemas?.['enumVarNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate x-enumNames types', async () => { - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) diff --git a/packages/swagger-faker/src/FakerGenerator.ts b/packages/swagger-faker/src/FakerGenerator.ts index a8629bf36..11c3023ac 100644 --- a/packages/swagger-faker/src/FakerGenerator.ts +++ b/packages/swagger-faker/src/FakerGenerator.ts @@ -4,35 +4,37 @@ import { pluginKey as swaggerTypeScriptPluginKey } from '@kubb/swagger-ts' import { fakerParser } from './fakerParser.tsx' import { pluginKey } from './plugin.ts' -import type { SchemaGeneratorBuildOptions, SchemaGeneratorOptions } from '@kubb/swagger' +import type { Schema as SchemaType, SchemaGeneratorBuildOptions, SchemaGeneratorOptions } from '@kubb/swagger' +import type { SchemaObject } from '@kubb/swagger/oas' type Options = SchemaGeneratorOptions & { seed?: number | number[] } export class FakerGenerator extends SchemaGenerator { - build({ - schema, - name: baseName, + async schema() { + return null + } + + getSource(name: string, schemas: SchemaType[], { operationName, operation, description, - }: SchemaGeneratorBuildOptions): string[] { + }: SchemaGeneratorBuildOptions = {}): string[] { const texts: string[] = [] - const input = this.getTypeFromSchema(schema, baseName) - const name = this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'function' }) - const typeName = this.context.pluginManager.resolveName({ name: baseName, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) + const resolvedName = this.context.pluginManager.resolveName({ name, pluginKey, type: 'function' }) + const typeName = this.context.pluginManager.resolveName({ name, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) - const output = fakerParser(input, { - name, + const output = fakerParser(schemas, { + name: resolvedName, typeName, description, seed: this.options.seed, }) // hack to add typescript imports if (typeName) { - const typeFileName = this.context.pluginManager.resolveName({ name: baseName, pluginKey: swaggerTypeScriptPluginKey, type: 'file' }) + const typeFileName = this.context.pluginManager.resolveName({ name, pluginKey: swaggerTypeScriptPluginKey, type: 'file' }) const typePath = this.context.pluginManager.resolvePath({ baseName: operationName || typeFileName, @@ -44,7 +46,8 @@ export class FakerGenerator extends SchemaGenerator { this.imports.push({ ref: { propertyName: typeName, - originalName: baseName, + originalName: name, + path: typePath, pluginKey: swaggerTypeScriptPluginKey, }, path: typePath, @@ -57,4 +60,9 @@ export class FakerGenerator extends SchemaGenerator { return texts } + buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] { + const schemas = this.buildSchemas(schema, name) + + return this.getSource(name, schemas, options) + } } diff --git a/packages/swagger-faker/src/OperationGenerator.test.tsx b/packages/swagger-faker/src/OperationGenerator.test.tsx index 7fa98b6a9..759f0f6be 100644 --- a/packages/swagger-faker/src/OperationGenerator.test.tsx +++ b/packages/swagger-faker/src/OperationGenerator.test.tsx @@ -38,8 +38,8 @@ describe('OperationGenerator', async () => { const operation = oas.operation('/pets', 'get') const operationShowById = oas.operation('/pets/{petId}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] - const getShowByIdFiles = await og.get(operationShowById, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] + const getShowByIdFiles = await og.operation(operationShowById, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -73,8 +73,8 @@ describe('OperationGenerator', async () => { const operation = oas.operation('/pets', 'get') const operationShowById = oas.operation('/pets/{petId}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] - const getShowByIdFiles = await og.get(operationShowById, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] + const getShowByIdFiles = await og.operation(operationShowById, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -106,7 +106,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets', 'post') - const files = await og.post(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -134,7 +134,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pet/{petId}', 'delete') - const files = await og.delete(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() diff --git a/packages/swagger-faker/src/OperationGenerator.tsx b/packages/swagger-faker/src/OperationGenerator.tsx index 19d012cd5..04ff2c2ee 100644 --- a/packages/swagger-faker/src/OperationGenerator.tsx +++ b/packages/swagger-faker/src/OperationGenerator.tsx @@ -23,7 +23,7 @@ export class OperationGenerator extends Generator>({ logger: pluginManager.logger }) root.render( - this.getSchemas(...props)}> + this.getSchemas(...props)}> @@ -34,35 +34,21 @@ export class OperationGenerator extends Generator { - return this.operation(operation, options) + async get(): OperationMethodResult { + return null } - async post( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + + async post(): OperationMethodResult { + return null } - async put( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async put(): OperationMethodResult { + return null } - async patch( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async patch(): OperationMethodResult { + return null } - async delete( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-faker/src/components/Schema.test.tsx b/packages/swagger-faker/src/components/Schema.test.tsx index 09084253e..21f8dee85 100644 --- a/packages/swagger-faker/src/components/Schema.test.tsx +++ b/packages/swagger-faker/src/components/Schema.test.tsx @@ -56,7 +56,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> @@ -75,7 +75,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-faker/src/components/Schema.tsx b/packages/swagger-faker/src/components/Schema.tsx index 636f37f54..859c07f9e 100644 --- a/packages/swagger-faker/src/components/Schema.tsx +++ b/packages/swagger-faker/src/components/Schema.tsx @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/ban-types */ import { Editor, File, usePlugin, usePluginManager } from '@kubb/react' import { OasParser } from '@kubb/swagger/components' -import { useGetOperationFile, useOas, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOas, useOperationSchemas } from '@kubb/swagger/hooks' import { FakerGenerator } from '../FakerGenerator.ts' @@ -28,10 +28,10 @@ Schema.File = function({ mode = 'directory' }: FileProps): ReactNode { const pluginManager = usePluginManager() const oas = useOas() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() - const generator = new FakerGenerator(plugin.options, { oas, plugin, pluginManager }) + const generator = new FakerGenerator(plugin.options, { oas, plugin, pluginManager, contentType: undefined, include: undefined }) const items = [ schemas.pathParams, diff --git a/packages/swagger-msw/src/OperationGenerator.tsx b/packages/swagger-msw/src/OperationGenerator.tsx index b8ec85f17..6448fa391 100644 --- a/packages/swagger-msw/src/OperationGenerator.tsx +++ b/packages/swagger-msw/src/OperationGenerator.tsx @@ -23,7 +23,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> {templates?.operations && } , { meta: { pluginManager, plugin } }, @@ -32,7 +32,7 @@ export class OperationGenerator extends Generator { + async operation(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { const { oas, pluginManager, plugin } = this.context const root = createRoot>({ logger: pluginManager.logger }) @@ -48,7 +48,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> @@ -59,21 +59,21 @@ export class OperationGenerator extends Generator { - return this.#generate(operation, options) + async get(): OperationMethodResult { + return null } - async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async post(): OperationMethodResult { + return null } - async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async put(): OperationMethodResult { + return null } - async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async patch(): OperationMethodResult { + return null } - async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { - return this.#generate(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-msw/src/components/Mock.test.tsx b/packages/swagger-msw/src/components/Mock.test.tsx index 32cbd481f..c9ca8b287 100644 --- a/packages/swagger-msw/src/components/Mock.test.tsx +++ b/packages/swagger-msw/src/components/Mock.test.tsx @@ -44,7 +44,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> @@ -63,7 +63,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-msw/src/components/Mock.tsx b/packages/swagger-msw/src/components/Mock.tsx index e56ebc271..88c1a4748 100644 --- a/packages/swagger-msw/src/components/Mock.tsx +++ b/packages/swagger-msw/src/components/Mock.tsx @@ -1,7 +1,7 @@ import { PackageManager } from '@kubb/core' import { URLPath } from '@kubb/core/utils' import { Editor, File, useResolveName } from '@kubb/react' -import { useOperation, useGetOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOperation, useOperationName, useOperationSchemas } from '@kubb/swagger/hooks' import { pluginKey as fakerPluginKey } from '@kubb/swagger-faker' import type { HttpMethod } from '@kubb/swagger/oas' @@ -81,7 +81,7 @@ type Props = { export function Mock({ Template = defaultTemplates.default, }: Props): ReactNode { - const schemas = useSchemas() + const schemas = useOperationSchemas() const name = useOperationName({ type: 'function' }) const responseName = useResolveName({ pluginKey: fakerPluginKey, name: schemas.response.name, type: 'type' }) const operation = useOperation() @@ -99,7 +99,7 @@ type FileProps = { } Mock.File = function({ templates = defaultTemplates }: FileProps): ReactNode { - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileFaker = useGetOperationFile({ pluginKey: fakerPluginKey }) const responseName = useResolveName({ pluginKey: fakerPluginKey, name: schemas.response.name, type: 'function' }) diff --git a/packages/swagger-swr/src/OperationGenerator.tsx b/packages/swagger-swr/src/OperationGenerator.tsx index ad6dbc195..6a78622af 100644 --- a/packages/swagger-swr/src/OperationGenerator.tsx +++ b/packages/swagger-swr/src/OperationGenerator.tsx @@ -16,6 +16,10 @@ export class OperationGenerator extends Generator { + return null + } + async get(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult { const { oas, pluginManager, plugin } = this.context @@ -26,7 +30,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> @@ -47,7 +51,7 @@ export class OperationGenerator extends Generator this.getSchemas(...props)}> + this.getSchemas(...props)}> diff --git a/packages/swagger-swr/src/components/Mutation.test.tsx b/packages/swagger-swr/src/components/Mutation.test.tsx index 1dfc625e3..301d2be90 100644 --- a/packages/swagger-swr/src/components/Mutation.test.tsx +++ b/packages/swagger-swr/src/components/Mutation.test.tsx @@ -59,7 +59,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-swr/src/components/Mutation.tsx b/packages/swagger-swr/src/components/Mutation.tsx index f3b678158..a0c079e85 100644 --- a/packages/swagger-swr/src/components/Mutation.tsx +++ b/packages/swagger-swr/src/components/Mutation.tsx @@ -1,7 +1,7 @@ import transformers from '@kubb/core/transformers' import { FunctionParams, URLPath } from '@kubb/core/utils' import { Editor, File, Function, usePlugin } from '@kubb/react' -import { useGetOperationFile, useOperation, useOperationName, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOperation, useOperationName, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams, getComments } from '@kubb/swagger/utils' import { pluginKey as swaggerTsPluginKey } from '@kubb/swagger-ts' @@ -135,7 +135,7 @@ export function Mutation({ const { options: { dataReturnType } } = usePlugin() const operation = useOperation() const name = useOperationName({ type: 'function' }) - const schemas = useSchemas() + const schemas = useOperationSchemas() const params = new FunctionParams() const client = { @@ -206,7 +206,7 @@ type FileProps = { Mutation.File = function({ templates = defaultTemplates }: FileProps): ReactNode { const { options: { client: { importPath } } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileType = useGetOperationFile({ pluginKey: swaggerTsPluginKey }) const factoryName = useOperationName({ type: 'type' }) diff --git a/packages/swagger-swr/src/components/Query.test.tsx b/packages/swagger-swr/src/components/Query.test.tsx index 8923f79f9..1d9c2984f 100644 --- a/packages/swagger-swr/src/components/Query.test.tsx +++ b/packages/swagger-swr/src/components/Query.test.tsx @@ -61,7 +61,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-swr/src/components/Query.tsx b/packages/swagger-swr/src/components/Query.tsx index 876933c31..dea0bfb58 100644 --- a/packages/swagger-swr/src/components/Query.tsx +++ b/packages/swagger-swr/src/components/Query.tsx @@ -1,6 +1,6 @@ import { FunctionParams, URLPath } from '@kubb/core/utils' import { Editor, File, Function, usePlugin, useResolveName } from '@kubb/react' -import { useGetOperationFile, useOperation, useOperationName, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOperation, useOperationName, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams, getComments } from '@kubb/swagger/utils' import { pluginKey as swaggerTsPluginKey } from '@kubb/swagger-ts' @@ -123,7 +123,7 @@ export function Query({ }: Props): ReactNode { const { key: pluginKey, options: { dataReturnType } } = usePlugin() const operation = useOperation() - const schemas = useSchemas() + const schemas = useOperationSchemas() const name = useOperationName({ type: 'function' }) const queryOptionsName = useResolveName({ name: `${factory.name}QueryOptions`, pluginKey }) @@ -229,7 +229,7 @@ type FileProps = { Query.File = function({ templates }: FileProps): ReactNode { const { options: { client: { importPath } } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileType = useGetOperationFile({ pluginKey: swaggerTsPluginKey }) const factoryName = useOperationName({ type: 'type' }) diff --git a/packages/swagger-swr/src/components/QueryOptions.tsx b/packages/swagger-swr/src/components/QueryOptions.tsx index 30926a3e8..e45b70165 100644 --- a/packages/swagger-swr/src/components/QueryOptions.tsx +++ b/packages/swagger-swr/src/components/QueryOptions.tsx @@ -1,7 +1,7 @@ import transformers from '@kubb/core/transformers' import { FunctionParams, URLPath } from '@kubb/core/utils' import { Function, usePlugin, useResolveName } from '@kubb/react' -import { useOperation, useSchemas } from '@kubb/swagger/hooks' +import { useOperation, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams } from '@kubb/swagger/utils' import type { HttpMethod } from '@kubb/swagger/oas' @@ -98,7 +98,7 @@ type Props = { export function QueryOptions({ factory, dataReturnType, Template = defaultTemplates.default }: Props): ReactNode { const { key: pluginKey } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const name = useResolveName({ name: `${factory.name}QueryOptions`, pluginKey }) diff --git a/packages/swagger-swr/src/components/SchemaType.tsx b/packages/swagger-swr/src/components/SchemaType.tsx index b1a4a77c8..6f0ac1ef0 100644 --- a/packages/swagger-swr/src/components/SchemaType.tsx +++ b/packages/swagger-swr/src/components/SchemaType.tsx @@ -1,5 +1,5 @@ import { Type, usePlugin } from '@kubb/react' -import { useSchemas } from '@kubb/swagger/hooks' +import { useOperationSchemas } from '@kubb/swagger/hooks' import type { ReactNode } from 'react' import type { PluginOptions } from '../types.ts' @@ -13,7 +13,7 @@ type Props = { export function SchemaType({ factory }: Props): ReactNode { const { options: { dataReturnType } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const [TData, TError, TRequest, TPathParams, TQueryParams, THeaderParams, TResponse] = [ schemas.response.name, diff --git a/packages/swagger-tanstack-query/src/OperationGenerator.test.tsx b/packages/swagger-tanstack-query/src/OperationGenerator.test.tsx index f881c175a..4638ed009 100644 --- a/packages/swagger-tanstack-query/src/OperationGenerator.test.tsx +++ b/packages/swagger-tanstack-query/src/OperationGenerator.test.tsx @@ -206,7 +206,7 @@ describe('OperationGenerator', async () => { override: undefined, }) - const files = (await og[method](operation, options)) as KubbFile.File[] + const files = (await og.operation(operation, options)) as KubbFile.File[] files.forEach((file) => { expect(FileManager.getSource(file)).toMatchFileSnapshot( diff --git a/packages/swagger-tanstack-query/src/OperationGenerator.tsx b/packages/swagger-tanstack-query/src/OperationGenerator.tsx index 1c2e7b0f2..bafaff5f9 100644 --- a/packages/swagger-tanstack-query/src/OperationGenerator.tsx +++ b/packages/swagger-tanstack-query/src/OperationGenerator.tsx @@ -38,7 +38,7 @@ export class OperationGenerator extends Generator< this.getSchemas(...props)} + getOperationSchemas={(...props) => this.getSchemas(...props)} > {templates.operations && } , @@ -75,7 +75,7 @@ export class OperationGenerator extends Generator< this.getSchemas(...props)} + getOperationSchemas={(...props) => this.getSchemas(...props)} > {isMutate && templates?.mutation && } @@ -96,34 +96,21 @@ export class OperationGenerator extends Generator< return root.files } - async get( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async get(): OperationMethodResult { + return null } - async post( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + + async post(): OperationMethodResult { + return null } - async put( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + + async put(): OperationMethodResult { + return null } - async patch( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async patch(): OperationMethodResult { + return null } - async delete( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-tanstack-query/src/components/Mutation.test.tsx b/packages/swagger-tanstack-query/src/components/Mutation.test.tsx index 535c7d0f7..b6a8cc5ef 100644 --- a/packages/swagger-tanstack-query/src/components/Mutation.test.tsx +++ b/packages/swagger-tanstack-query/src/components/Mutation.test.tsx @@ -75,7 +75,7 @@ describe('', async () => { og.getSchemas(...props)} + getOperationSchemas={(...props) => og.getSchemas(...props)} > @@ -132,7 +132,7 @@ describe('', async () => { og.getSchemas(...props)} + getOperationSchemas={(...props) => og.getSchemas(...props)} > diff --git a/packages/swagger-tanstack-query/src/components/Mutation.tsx b/packages/swagger-tanstack-query/src/components/Mutation.tsx index ff4f030e2..90a70c7f6 100644 --- a/packages/swagger-tanstack-query/src/components/Mutation.tsx +++ b/packages/swagger-tanstack-query/src/components/Mutation.tsx @@ -3,10 +3,10 @@ import transformers from '@kubb/core/transformers' import { FunctionParams, URLPath } from '@kubb/core/utils' import { Editor, File, Function, usePlugin } from '@kubb/react' import { - useOperation, useGetOperationFile, + useOperation, useOperationName, - useSchemas, + useOperationSchemas, } from '@kubb/swagger/hooks' import { getASTParams, getComments, isRequired } from '@kubb/swagger/utils' import { pluginKey as swaggerTsPluginKey } from '@kubb/swagger-ts' @@ -166,7 +166,7 @@ const defaultTemplates = { const hookName = importNames.mutation.vue.hookName const resultType = importNames.mutation.vue.resultType const optionsType = importNames.mutation.vue.optionsType - const schemas = useSchemas() + const schemas = useOperationSchemas() const params = new FunctionParams() const resultGenerics = [ @@ -277,7 +277,7 @@ export function Mutation({ const operation = useOperation() const name = useOperationName({ type: 'function' }) - const schemas = useSchemas() + const schemas = useOperationSchemas() const params = new FunctionParams() const mutateParams = new FunctionParams() @@ -442,7 +442,7 @@ Mutation.File = function({ framework, }, } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileType = useGetOperationFile({ pluginKey: swaggerTsPluginKey }) const factoryName = useOperationName({ type: 'type' }) diff --git a/packages/swagger-tanstack-query/src/components/Query.test.tsx b/packages/swagger-tanstack-query/src/components/Query.test.tsx index f40183265..91e48cbac 100644 --- a/packages/swagger-tanstack-query/src/components/Query.test.tsx +++ b/packages/swagger-tanstack-query/src/components/Query.test.tsx @@ -79,7 +79,7 @@ describe('', async () => { og.getSchemas(...props)} + getOperationSchemas={(...props) => og.getSchemas(...props)} > diff --git a/packages/swagger-tanstack-query/src/components/Query.tsx b/packages/swagger-tanstack-query/src/components/Query.tsx index a9cbbebbd..cb88f6eb8 100644 --- a/packages/swagger-tanstack-query/src/components/Query.tsx +++ b/packages/swagger-tanstack-query/src/components/Query.tsx @@ -3,10 +3,10 @@ import transformers from '@kubb/core/transformers' import { FunctionParams, URLPath } from '@kubb/core/utils' import { Editor, File, Function, usePlugin, useResolveName } from '@kubb/react' import { - useOperation, useGetOperationFile, + useOperation, useOperationName, - useSchemas, + useOperationSchemas, } from '@kubb/swagger/hooks' import { getASTParams, @@ -183,7 +183,7 @@ const defaultTemplates = { ? importNames.queryInfinite.vue.optionsType : importNames.query.vue.optionsType - const schemas = useSchemas() + const schemas = useOperationSchemas() const isV5 = new PackageManager().isValidSync(/@tanstack/, '>=5') const params = new FunctionParams() const queryParams = new FunctionParams() @@ -342,7 +342,7 @@ export function Query({ options: { dataReturnType, pathParamsType }, } = usePlugin() const operation = useOperation() - const schemas = useSchemas() + const schemas = useOperationSchemas() const name = useOperationName({ type: 'function' }) const isV5 = new PackageManager().isValidSync(/@tanstack/, '>=5') @@ -576,7 +576,7 @@ Query.File = function({ }, } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const fileType = useGetOperationFile({ pluginKey: swaggerTsPluginKey }) const fileZodSchemas = useGetOperationFile({ pluginKey: swaggerZodPluginKey }) diff --git a/packages/swagger-tanstack-query/src/components/QueryKey.tsx b/packages/swagger-tanstack-query/src/components/QueryKey.tsx index b24f541ea..64cf45ea3 100644 --- a/packages/swagger-tanstack-query/src/components/QueryKey.tsx +++ b/packages/swagger-tanstack-query/src/components/QueryKey.tsx @@ -1,6 +1,6 @@ import { FunctionParams, URLPath } from '@kubb/core/utils' import { Function, Type, usePlugin } from '@kubb/react' -import { useOperation, useSchemas } from '@kubb/swagger/hooks' +import { useOperation, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams, isRequired } from '@kubb/swagger/utils' import type { ReactNode } from 'react' @@ -97,7 +97,7 @@ const defaultTemplates = { const { options: { pathParamsType }, } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const path = new URLPath(operation.path) const params = new FunctionParams() @@ -156,7 +156,7 @@ export function QueryKey({ const { options: { pathParamsType }, } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const path = new URLPath(operation.path) const params = new FunctionParams() diff --git a/packages/swagger-tanstack-query/src/components/QueryOptions.tsx b/packages/swagger-tanstack-query/src/components/QueryOptions.tsx index de1068658..0e1147cdf 100644 --- a/packages/swagger-tanstack-query/src/components/QueryOptions.tsx +++ b/packages/swagger-tanstack-query/src/components/QueryOptions.tsx @@ -2,7 +2,7 @@ import { PackageManager } from '@kubb/core' import transformers from '@kubb/core/transformers' import { FunctionParams, URLPath } from '@kubb/core/utils' import { Function, usePlugin, useResolveName } from '@kubb/react' -import { useOperation, useSchemas } from '@kubb/swagger/hooks' +import { useOperation, useOperationSchemas } from '@kubb/swagger/hooks' import { getASTParams, getParams, isRequired } from '@kubb/swagger/utils' import { pluginKey as swaggerZodPluginKey } from '@kubb/swagger-zod' @@ -256,7 +256,7 @@ const defaultTemplates = { options: { pathParamsType }, } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const params = new FunctionParams() const pathParams = getParams(schemas.pathParams, { @@ -363,7 +363,7 @@ export function QueryOptions({ return null } - const schemas = useSchemas() + const schemas = useOperationSchemas() const operation = useOperation() const queryKey = useResolveName({ diff --git a/packages/swagger-tanstack-query/src/components/SchemaType.tsx b/packages/swagger-tanstack-query/src/components/SchemaType.tsx index b1a4a77c8..6f0ac1ef0 100644 --- a/packages/swagger-tanstack-query/src/components/SchemaType.tsx +++ b/packages/swagger-tanstack-query/src/components/SchemaType.tsx @@ -1,5 +1,5 @@ import { Type, usePlugin } from '@kubb/react' -import { useSchemas } from '@kubb/swagger/hooks' +import { useOperationSchemas } from '@kubb/swagger/hooks' import type { ReactNode } from 'react' import type { PluginOptions } from '../types.ts' @@ -13,7 +13,7 @@ type Props = { export function SchemaType({ factory }: Props): ReactNode { const { options: { dataReturnType } } = usePlugin() - const schemas = useSchemas() + const schemas = useOperationSchemas() const [TData, TError, TRequest, TPathParams, TQueryParams, THeaderParams, TResponse] = [ schemas.response.name, diff --git a/packages/swagger-ts/src/OperationGenerator.test.tsx b/packages/swagger-ts/src/OperationGenerator.test.tsx index e5bf6aa36..e094af8d7 100644 --- a/packages/swagger-ts/src/OperationGenerator.test.tsx +++ b/packages/swagger-ts/src/OperationGenerator.test.tsx @@ -42,8 +42,8 @@ describe('OperationGenerator', async () => { const operation = oas.operation('/pets', 'get') const operationShowById = oas.operation('/pets/{petId}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] - const getShowByIdFiles = await og.get(operationShowById, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] + const getShowByIdFiles = await og.operation(operationShowById, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -79,7 +79,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets', 'post') - const files = await og.post(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -111,7 +111,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pet/{petId}', 'delete') - const files = await og.delete(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -142,7 +142,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pet/{petId}', 'delete') - const files = await og.delete(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() diff --git a/packages/swagger-ts/src/OperationGenerator.tsx b/packages/swagger-ts/src/OperationGenerator.tsx index 61be1947d..99f930faf 100644 --- a/packages/swagger-ts/src/OperationGenerator.tsx +++ b/packages/swagger-ts/src/OperationGenerator.tsx @@ -3,7 +3,7 @@ import { OperationGenerator as Generator } from '@kubb/swagger' import { Oas } from '@kubb/swagger/components' import { OasType } from './components/OasType.tsx' -import { Schema } from './components/Schema.tsx' +import { OperationSchema } from './components/OperationSchema.tsx' import type { AppContextProps } from '@kubb/react' import type { OperationMethodResult } from '@kubb/swagger' @@ -17,7 +17,7 @@ export class OperationGenerator extends Generator>({ logger: pluginManager.logger }) root.render( - this.getSchemas(...props)}> + this.getSchemas(...props)}> {plugin.options.oasType && } , { meta: { pluginManager, plugin } }, @@ -34,9 +34,9 @@ export class OperationGenerator extends Generator>({ logger: pluginManager.logger }) root.render( - this.getSchemas(...props)}> + this.getSchemas(...props)}> - + , { meta: { pluginManager, plugin: { ...plugin, options } } }, @@ -45,35 +45,21 @@ export class OperationGenerator extends Generator { - return this.operation(operation, options) + async get(): OperationMethodResult { + return null } - async post( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + + async post(): OperationMethodResult { + return null } - async put( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async put(): OperationMethodResult { + return null } - async patch( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async patch(): OperationMethodResult { + return null } - async delete( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-ts/src/TypeGenerator.test.ts b/packages/swagger-ts/src/SchemaGenerator.test.tsx similarity index 69% rename from packages/swagger-ts/src/TypeGenerator.test.ts rename to packages/swagger-ts/src/SchemaGenerator.test.tsx index f1c717352..8effdc0bc 100644 --- a/packages/swagger-ts/src/TypeGenerator.test.ts +++ b/packages/swagger-ts/src/SchemaGenerator.test.tsx @@ -3,18 +3,18 @@ import path from 'node:path' import { mockedPluginManager } from '@kubb/core/mocks' import { OasManager } from '@kubb/swagger' -import { TypeGenerator } from './TypeGenerator.ts' +import { SchemaGenerator } from './SchemaGenerator.tsx' import type { Plugin, PluginManager } from '@kubb/core' -import type { Oas, OasTypes } from '@kubb/swagger/oas' +import type { Oas, OasTypes, SchemaObject } from '@kubb/swagger/oas' import type { PluginOptions } from './types.ts' -describe('TypeGenerator petStore', async () => { +describe('SchemaGenerator petStore', async () => { const petStorePath = path.resolve(__dirname, '../mocks/petStore.yaml') const oas = await new OasManager().parse(petStorePath) test('generate type for Pet with optionalType `questionToken`', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: 'enum', @@ -27,16 +27,18 @@ describe('TypeGenerator petStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pet as OasTypes.SchemaObject, name: 'Pet' }) + const node = generator.buildSource('Pet', schemas?.Pet as SchemaObject) expect(node).toMatchSnapshot() }) test('generate type for Pet with optionalType `undefined`', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -49,16 +51,18 @@ describe('TypeGenerator petStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pet as OasTypes.SchemaObject, name: 'Pet' }) + const node = generator.buildSource('Pet', schemas?.Pet as SchemaObject) expect(node).toMatchSnapshot() }) test('generate type for Pet with optionalType `questionTokenAndUndefined`', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -71,16 +75,18 @@ describe('TypeGenerator petStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pet as OasTypes.SchemaObject, name: 'Pet' }) + const node = generator.buildSource('Pet', schemas?.Pet as SchemaObject) expect(node).toMatchSnapshot() }) test('generate type for nullable fields', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -93,6 +99,8 @@ describe('TypeGenerator petStore', async () => { oas: {} as Oas, pluginManager: { resolveName: ({ name }) => name, resolvePath: ({ baseName }) => baseName } as PluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schema: OasTypes.SchemaObject = { @@ -105,13 +113,13 @@ describe('TypeGenerator petStore', async () => { }, } - const node = generator.build({ schema, name: 'Test' }) + const node = generator.buildSource('Test', schema) expect(node).toMatchSnapshot() }) test('generate type for Pets', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -124,21 +132,23 @@ describe('TypeGenerator petStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pets as OasTypes.SchemaObject, name: 'Pets' }) + const node = generator.buildSource('Pets', schemas?.Pets as SchemaObject) expect(node).toMatchSnapshot() }) }) -describe('TypeGenerator petStoreRef', async () => { +describe('SchemaGenerator petStoreRef', async () => { const petStoreRefPath = path.resolve(__dirname, '../mocks/petStoreRef.yaml') const oas = await new OasManager().parse(petStoreRefPath) test('generate type for Pets', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -151,21 +161,23 @@ describe('TypeGenerator petStoreRef', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pets as OasTypes.SchemaObject, name: 'Pets' }) + const node = generator.buildSource('Pets', schemas?.Pets as SchemaObject) expect(node).toMatchSnapshot() }) }) -describe('TypeGenerator discriminator', async () => { +describe('SchemaGenerator discriminator', async () => { const discriminatorPath = path.resolve(__dirname, '../mocks/discriminator.yaml') const oas = await new OasManager().parse(discriminatorPath) test('PetStore defined as array with type union', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -178,16 +190,18 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Petstore as OasTypes.SchemaObject, name: 'Petstore' }) + const node = generator.buildSource('Petstore', schemas?.Petstore as SchemaObject) expect(node).toMatchSnapshot() }) test('Cat.type defined as const', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -200,16 +214,18 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Cat as OasTypes.SchemaObject, name: 'Cat' }) + const node = generator.buildSource('Cat', schemas?.Cat as SchemaObject) expect(node).toMatchSnapshot() }) test('Dog.type defined as const', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -222,16 +238,18 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Dog as OasTypes.SchemaObject, name: 'Dog' }) + const node = generator.buildSource('Dog', schemas?.Dog as SchemaObject) expect(node).toMatchSnapshot() }) test('NullConst correctly produces "null"', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -244,15 +262,17 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.NullConst as OasTypes.SchemaObject, name: 'NullConst' }) + const node = generator.buildSource('NullConst', schemas?.NullConst as SchemaObject) expect(node).toMatchSnapshot() }) test('StringValueConst const correctly produces "foobar"', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -265,16 +285,18 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.StringValueConst as OasTypes.SchemaObject, name: 'StringValueConst' }) + const node = generator.buildSource('StringValueConst', schemas?.StringValueConst as SchemaObject) expect(node).toMatchSnapshot() }) test('NumberValueConst const correctly produces `42`', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -287,16 +309,18 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.NumberValueConst as OasTypes.SchemaObject, name: 'NumberValueConst' }) + const node = generator.buildSource('NumberValueConst', schemas?.NumberValueConst as SchemaObject) expect(node).toMatchSnapshot() }) test('MixedValueTypeConst ignores type constraint in favor of const constraint', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -309,19 +333,21 @@ describe('TypeGenerator discriminator', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.MixedValueTypeConst as OasTypes.SchemaObject, name: 'MixedValueTypeConst' }) + const node = generator.buildSource('MixedValueTypeConst', schemas?.MixedValueTypeConst as SchemaObject) expect(node).toMatchSnapshot() }) }) -describe('TypeGenerator enums', async () => { +describe('SchemaGenerator enums', async () => { const schemaPath = path.resolve(__dirname, '../mocks/enums.yaml') const oas = await new OasManager().parse(schemaPath) - const defaultGenerator = new TypeGenerator({ + const defaultGenerator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asConst', enumSuffix: '', @@ -334,54 +360,56 @@ describe('TypeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas test('generate x-enum-varnames Type', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enumVarNames.Type'] as OasTypes.SchemaObject, name: 'enumVarNames' }) + const node = defaultGenerator.buildSource('enumVarNames', schemas?.['enumVarNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate x-enumNames Type', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = defaultGenerator.buildSource('enumNames', schemas?.['enumNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate enum Items', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enum.Items'] as OasTypes.SchemaObject, name: 'enumItems' }) + const node = defaultGenerator.buildSource('enumItems', schemas?.['enum.Items'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate enum String', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enum.String'] as OasTypes.SchemaObject, name: 'enumString' }) + const node = defaultGenerator.buildSource('enumString', schemas?.['enum.String'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate enum AllOf', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enum.AllOf'] as OasTypes.SchemaObject, name: 'enumObject' }) + const node = defaultGenerator.buildSource('enumObject', schemas?.['enum.AllOf'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate enum InObject', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enum.InObject'] as OasTypes.SchemaObject, name: 'enumObject' }) + const node = defaultGenerator.buildSource('enumObject', schemas?.['enum.InObject'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate enum Array', async () => { - const node = defaultGenerator.build({ schema: schemas?.['enum.Array'] as OasTypes.SchemaObject, name: 'enumArray' }) + const node = defaultGenerator.buildSource('enumArray', schemas?.['enum.Array'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate with enumtype enum', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'enum', enumSuffix: '', @@ -394,15 +422,17 @@ describe('TypeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as OasTypes.SchemaObject) expect(node).toMatchSnapshot() }) test('generate with enumtype asPascalConst', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'asPascalConst', enumSuffix: '', @@ -415,15 +445,17 @@ describe('TypeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as OasTypes.SchemaObject) expect(node).toMatchSnapshot() }) test('generate with enumtype constEnum', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'constEnum', enumSuffix: '', @@ -436,15 +468,17 @@ describe('TypeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate with enumtype literal', async () => { - const generator = new TypeGenerator({ + const generator = new SchemaGenerator({ usedEnumNames: {}, enumType: 'literal', enumSuffix: '', @@ -457,9 +491,11 @@ describe('TypeGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) diff --git a/packages/swagger-ts/src/SchemaGenerator.tsx b/packages/swagger-ts/src/SchemaGenerator.tsx new file mode 100644 index 000000000..b30ae63c8 --- /dev/null +++ b/packages/swagger-ts/src/SchemaGenerator.tsx @@ -0,0 +1,60 @@ +import { createRoot } from '@kubb/react' +import { SchemaGenerator as Generator } from '@kubb/swagger' +import { Oas, Schema } from '@kubb/swagger/components' +import { pluginKey as swaggerTypeScriptPluginKey } from '@kubb/swagger-ts' + +import { pluginKey } from './plugin.ts' +import { typeParser } from './typeParser.ts' + +import type { AppContextProps } from '@kubb/react' +import type { Schema as SchemaType, SchemaGeneratorBuildOptions, SchemaMethodResult } from '@kubb/swagger' +import type { SchemaObject } from '@kubb/swagger/oas' +import type { FileMeta, PluginOptions } from './types.ts' + +export class SchemaGenerator extends Generator { + async schema(name: string, object: SchemaObject): SchemaMethodResult { + const { oas, pluginManager, mode, plugin, output } = this.context + + const root = createRoot>({ logger: pluginManager.logger }) + + root.render( + + + + + , + { meta: { pluginManager, plugin } }, + ) + + return root.files + } + // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext + getSource(name: string, schemas: SchemaType[], { + keysToOmit, + description, + }: SchemaGeneratorBuildOptions = {}) { + const texts: string[] = [] + + const resolvedName = this.context.pluginManager.resolveName({ name, pluginKey, type: 'function' }) + const resvoledTypeName = this.context.pluginManager.resolveName({ name, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) + + const typeOutput = typeParser(schemas, { + name: resolvedName, + typeName: resvoledTypeName, + description, + enumType: this.options.enumType || 'asConst', + optionalType: this.options.optionalType, + keysToOmit, + }) + + texts.push(typeOutput) + + return texts + } + + buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] { + const schemas = this.buildSchemas(schema, name) + + return this.getSource(name, schemas, options) + } +} diff --git a/packages/swagger-ts/src/TypeBuilder.ts b/packages/swagger-ts/src/TypeBuilder.ts deleted file mode 100644 index 9af3a298f..000000000 --- a/packages/swagger-ts/src/TypeBuilder.ts +++ /dev/null @@ -1,55 +0,0 @@ -import transformers from '@kubb/core/transformers' -import { OasBuilder } from '@kubb/swagger' -import { refsSorter } from '@kubb/swagger/utils' - -import { TypeGenerator } from './TypeGenerator.ts' - -import type { KubbFile } from '@kubb/core' -import type { ImportMeta } from '@kubb/swagger' -import type { PluginOptions } from './types.ts' - -/** - * @deprecated replace with Schema component - */ -export class TypeBuilder extends OasBuilder { - build(name?: string): Required> { - const importMeta: ImportMeta[] = [] - const codes: string[] = [] - - const generated = this.items - .filter((operationSchema) => (name ? operationSchema.name === name : true)) - .sort(transformers.nameSorter) - .map((operationSchema) => { - const generator = new TypeGenerator(this.options, this.context) - - const sources = generator.build(operationSchema) - importMeta.push(...generator.imports) - - return { - import: { - refs: generator.refs, - name: operationSchema.name, - }, - sources, - } - }) - .sort(refsSorter) - - generated.forEach((item) => { - codes.push(...item.sources) - }) - - const imports: KubbFile.Import[] = importMeta.map((item) => { - return { - name: [item.ref.propertyName], - path: item.path, - isTypeOnly: true, - } - }) - - return { - imports, - source: transformers.combineCodes(codes), - } - } -} diff --git a/packages/swagger-ts/src/TypeGenerator.ts b/packages/swagger-ts/src/TypeGenerator.ts deleted file mode 100644 index ebcafc9d7..000000000 --- a/packages/swagger-ts/src/TypeGenerator.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { SchemaGenerator } from '@kubb/swagger' -import { pluginKey as swaggerTypeScriptPluginKey } from '@kubb/swagger-ts' - -import { pluginKey } from './plugin.ts' -import { typeParser } from './typeParser.ts' - -import type { SchemaGeneratorBuildOptions, SchemaGeneratorOptions } from '@kubb/swagger' - -type Options = SchemaGeneratorOptions & { - optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined' - oasType: 'infer' | false -} - -export class TypeGenerator extends SchemaGenerator { - build({ - schema, - name: baseName, - keysToOmit, - description, - }: SchemaGeneratorBuildOptions): string[] { - const texts: string[] = [] - const input = this.getTypeFromSchema(schema, baseName) - - const name = this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'function' }) - const typeName = this.context.pluginManager.resolveName({ name: baseName, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) - - const typeOutput = typeParser(input, { - name, - typeName, - description, - enumType: this.options.enumType || 'asConst', - optionalType: this.options.optionalType, - keysToOmit, - }) - - texts.push(typeOutput) - - return texts - } -} diff --git a/packages/swagger-ts/src/__snapshots__/OperationGenerator.test.tsx.snap b/packages/swagger-ts/src/__snapshots__/OperationGenerator.test.tsx.snap index b75cd46a7..646bd9321 100644 --- a/packages/swagger-ts/src/__snapshots__/OperationGenerator.test.tsx.snap +++ b/packages/swagger-ts/src/__snapshots__/OperationGenerator.test.tsx.snap @@ -2,7 +2,8 @@ exports[`OperationGenerator > [DELETE] /pet/{petId} with unknownType \`any\` 1`] = ` "export type DeletePetPetidMutationResponse = any; -export type DeletePetPetidMutation = { + + export type DeletePetPetidMutation = { Response: DeletePetPetidMutationResponse; }; " @@ -10,7 +11,8 @@ export type DeletePetPetidMutation = { exports[`OperationGenerator > [DELETE] /pet/{petId} with unknownType \`unknown\` 1`] = ` "export type DeletePetPetidMutationResponse = unknown; -export type DeletePetPetidMutation = { + + export type DeletePetPetidMutation = { Response: DeletePetPetidMutationResponse; }; " @@ -20,16 +22,6 @@ exports[`OperationGenerator > [GET] /pets with optionalType \`questionToken\` 1` "import type { Pets } from "./Pets"; import type { Error } from "./Error"; - /** - * @description A paged array of pets -*/ -export type ListPets200 = Pets; - - /** - * @description unexpected error -*/ -export type ListPetsError = Error; - export type ListPetsQueryParams = { /** * @description How many items to return at one time (max 100) @@ -42,7 +34,18 @@ export type ListPetsError = Error; * @description A paged array of pets */ export type ListPetsQueryResponse = Pets; -export type ListPetsQuery = { + + /** + * @description A paged array of pets +*/ +export type ListPets200 = Pets; + + /** + * @description unexpected error +*/ +export type ListPetsError = Error; + + export type ListPetsQuery = { Response: ListPetsQueryResponse; QueryParams: ListPetsQueryParams; }; @@ -53,16 +56,6 @@ exports[`OperationGenerator > [GET] /pets with optionalType \`questionToken\` 2` "import type { Pet } from "./Pet"; import type { Error } from "./Error"; - /** - * @description Expected response to a valid request -*/ -export type ShowPetById200 = Pet; - - /** - * @description unexpected error -*/ -export type ShowPetByIdError = Error; - export type ShowPetByIdPathParams = { /** * @description The id of the pet to retrieve @@ -80,7 +73,18 @@ export type ShowPetByIdError = Error; * @description Expected response to a valid request */ export type ShowPetByIdQueryResponse = Pet; -export type ShowPetByIdQuery = { + + /** + * @description Expected response to a valid request +*/ +export type ShowPetById200 = Pet; + + /** + * @description unexpected error +*/ +export type ShowPetByIdError = Error; + + export type ShowPetByIdQuery = { Response: ShowPetByIdQueryResponse; PathParams: ShowPetByIdPathParams; }; @@ -94,15 +98,10 @@ import type { ErrorCode } from "./ErrorCode"; /** * @description Null response */ -export type CreatePets201 = (Error & { +export type CreatePetsMutationResponse = (Error & { name?: ErrorCode; }); - /** - * @description unexpected error -*/ -export type CreatePetsError = Error; - export type CreatePetsMutationRequest = { /** * @type string @@ -117,10 +116,16 @@ export type CreatePetsError = Error; /** * @description Null response */ -export type CreatePetsMutationResponse = (Error & { +export type CreatePets201 = (Error & { name?: ErrorCode; }); -export type CreatePetsMutation = { + + /** + * @description unexpected error +*/ +export type CreatePetsError = Error; + + export type CreatePetsMutation = { Response: CreatePetsMutationResponse; Request: CreatePetsMutationRequest; }; diff --git a/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap new file mode 100644 index 000000000..3d021fdec --- /dev/null +++ b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap @@ -0,0 +1,329 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SchemaGenerator discriminator > Cat.type defined as const 1`] = ` +[ + "export type Cat = { + /** + * @type string uuid + */ + id: string; + type: "Cat"; + /** + * @type boolean | undefined + */ + meow?: boolean; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > Dog.type defined as const 1`] = ` +[ + "export type Dog = { + /** + * @type string uuid + */ + id: string; + /** + * @type number | undefined + */ + bark?: number; + type: "Dog"; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > MixedValueTypeConst ignores type constraint in favor of const constraint 1`] = ` +[ + "export type MixedValueTypeConst = { + foobar?: "foobar"; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > NullConst correctly produces "null" 1`] = ` +[ + "export type NullConst = { + withoutValue?: null; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > NumberValueConst const correctly produces \`42\` 1`] = ` +[ + "export type NumberValueConst = { + foobar?: 42; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > PetStore defined as array with type union 1`] = ` +[ + "export type Petstore = { + /** + * @type integer + */ + id: number; + /** + * @type array | undefined + */ + pets?: (Cat | Dog)[]; +}; +", +] +`; + +exports[`SchemaGenerator discriminator > StringValueConst const correctly produces "foobar" 1`] = ` +[ + "export type StringValueConst = { + foobar?: "foobar"; +}; +", +] +`; + +exports[`SchemaGenerator enums > generate enum AllOf 1`] = ` +[ + "export const enumObjectReason = { + "created_at": "created_at", + "description": "description" +} as const; +export type EnumObjectReason = (typeof enumObjectReason)[keyof typeof enumObjectReason]; +export type enumObject = { + reason?: EnumObjectReason; +}; +", +] +`; + +exports[`SchemaGenerator enums > generate enum Array 1`] = ` +[ + "export const enumArrayIdentifier = { + "NW": "NW", + "NE": "NE", + "SW": "SW", + "SE": "SE" +} as const; +export type EnumArrayIdentifier = (typeof enumArrayIdentifier)[keyof typeof enumArrayIdentifier]; +export type enumArray = { + identifier?: [ + number, + string, + EnumArrayIdentifier + ]; +}; +", +] +`; + +exports[`SchemaGenerator enums > generate enum InObject 1`] = ` +[ + "export const enumObjectReason2 = { + "created_at": "created_at", + "description": "description" +} as const; +export type EnumObjectReason2 = (typeof enumObjectReason2)[keyof typeof enumObjectReason2]; +export type enumObject = { + /** + * @type string | undefined + */ + reason?: EnumObjectReason2; +}; +", +] +`; + +exports[`SchemaGenerator enums > generate enum Items 1`] = ` +[ + "export const enumItems = { + "created_at": "created_at", + "description": "description" +} as const; +export type EnumItems = (typeof enumItems)[keyof typeof enumItems]; +export type enumItems = EnumItems[]; +", +] +`; + +exports[`SchemaGenerator enums > generate enum String 1`] = ` +[ + "export const enumString = { + "created_at": "created_at", + "description": "description", + "FILE.UPLOADED": "FILE.UPLOADED", + "FILE.DOWNLOADED": "FILE.DOWNLOADED" +} as const; +export type EnumString = (typeof enumString)[keyof typeof enumString]; +export type enumString = EnumString; +", +] +`; + +exports[`SchemaGenerator enums > generate with enumtype asPascalConst 1`] = ` +[ + "export const EnumNames = { + "Pending": 0, + "Received": 1 +} as const; +export type EnumNames = (typeof EnumNames)[keyof typeof EnumNames]; +export type enumNames = EnumNames; +", +] +`; + +exports[`SchemaGenerator enums > generate with enumtype constEnum 1`] = ` +[ + "export const enum EnumNames { + "Pending" = 0, + "Received" = 1 +} +export type enumNames = EnumNames; +", +] +`; + +exports[`SchemaGenerator enums > generate with enumtype enum 1`] = ` +[ + "export enum EnumNames { + "Pending" = 0, + "Received" = 1 +} +export type enumNames = EnumNames; +", +] +`; + +exports[`SchemaGenerator enums > generate with enumtype literal 1`] = ` +[ + "export type EnumNames = 0 | 1; +export type enumNames = EnumNames; +", +] +`; + +exports[`SchemaGenerator enums > generate x-enum-varnames Type 1`] = ` +[ + "export const enumVarNames = { + "Pending": 0, + "Received": 1 +} as const; +export type EnumVarNames = (typeof enumVarNames)[keyof typeof enumVarNames]; +export type enumVarNames = EnumVarNames; +", +] +`; + +exports[`SchemaGenerator enums > generate x-enumNames Type 1`] = ` +[ + "export const enumNames = { + "Pending": 0, + "Received": 1 +} as const; +export type EnumNames = (typeof enumNames)[keyof typeof enumNames]; +export type enumNames = EnumNames; +", +] +`; + +exports[`SchemaGenerator petStore > generate type for Pet with optionalType \`questionToken\` 1`] = ` +[ + "export type Pet = { + /** + * @type integer int64 + */ + id: number; + /** + * @type string + */ + name: string; + /** + * @type string | undefined + */ + tag?: string; +}; +", +] +`; + +exports[`SchemaGenerator petStore > generate type for Pet with optionalType \`questionTokenAndUndefined\` 1`] = ` +[ + "export type Pet = { + /** + * @type integer int64 + */ + id: number; + /** + * @type string + */ + name: string; + /** + * @type string | undefined + */ + tag?: string | undefined; +}; +", +] +`; + +exports[`SchemaGenerator petStore > generate type for Pet with optionalType \`undefined\` 1`] = ` +[ + "export type Pet = { + /** + * @type integer int64 + */ + id: number; + /** + * @type string + */ + name: string; + /** + * @type string | undefined + */ + tag: string | undefined; +}; +", +] +`; + +exports[`SchemaGenerator petStore > generate type for Pets 1`] = ` +[ + "export type Pets = { + /** + * @type integer int64 + */ + id: number; + /** + * @type string + */ + name: string; + /** + * @type string | undefined + */ + tag?: string; +}[]; +", +] +`; + +exports[`SchemaGenerator petStore > generate type for nullable fields 1`] = ` +[ + "export type Test = { + /** + * @type string + */ + foo: string | null; +}; +", +] +`; + +exports[`SchemaGenerator petStoreRef > generate type for Pets 1`] = ` +[ + "export type Pets = Pet[]; +", +] +`; diff --git a/packages/swagger-ts/src/components/Schema.test.tsx b/packages/swagger-ts/src/components/OperationSchema.test.tsx similarity index 84% rename from packages/swagger-ts/src/components/Schema.test.tsx rename to packages/swagger-ts/src/components/OperationSchema.test.tsx index fb60a6ccf..4428eb38a 100644 --- a/packages/swagger-ts/src/components/Schema.test.tsx +++ b/packages/swagger-ts/src/components/OperationSchema.test.tsx @@ -4,14 +4,14 @@ import { OasManager } from '@kubb/swagger' import { Oas } from '@kubb/swagger/components' import { OperationGenerator } from '../OperationGenerator.tsx' -import { Schema } from './Schema.tsx' +import { OperationSchema } from './OperationSchema.tsx' import type { Plugin } from '@kubb/core' import type { AppContextProps } from '@kubb/react' import type { GetOperationGeneratorOptions } from '@kubb/swagger' import type { PluginOptions } from '../types.ts' -describe('', async () => { +describe('', async () => { const oas = await OasManager.parseFromConfig({ root: './', output: { path: 'test', clean: true }, @@ -49,9 +49,9 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> - + ) @@ -69,9 +69,9 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> - + ) diff --git a/packages/swagger-ts/src/components/Schema.tsx b/packages/swagger-ts/src/components/OperationSchema.tsx similarity index 79% rename from packages/swagger-ts/src/components/Schema.tsx rename to packages/swagger-ts/src/components/OperationSchema.tsx index f3e0b7325..973ba3981 100644 --- a/packages/swagger-ts/src/components/Schema.tsx +++ b/packages/swagger-ts/src/components/OperationSchema.tsx @@ -4,10 +4,10 @@ import transformers from '@kubb/core/transformers' import { print } from '@kubb/parser' import * as factory from '@kubb/parser/factory' import { Editor, File, usePlugin, usePluginManager } from '@kubb/react' -import { OasParser } from '@kubb/swagger/components' -import { useGetOperationFile, useOas, useOperation, useOperationName, useSchemas } from '@kubb/swagger/hooks' +import { Oas, Schema } from '@kubb/swagger/components' +import { useGetOperationFile, useOas, useOperation, useOperationName, useOperationSchemas } from '@kubb/swagger/hooks' -import { TypeGenerator } from '../TypeGenerator.ts' +import { SchemaGenerator } from '../SchemaGenerator.tsx' import type { KubbFile } from '@kubb/core' import type { ts } from '@kubb/parser' @@ -88,7 +88,7 @@ function printCombinedSchema(name: string, operation: Operation, schemas: Operat return print(namespaceNode) } -export function Schema({}: Props): ReactNode { +export function OperationSchema({}: Props): ReactNode { return ( <> @@ -99,17 +99,17 @@ type FileProps = { mode: KubbFile.Mode | undefined } -Schema.File = function({ mode = 'directory' }: FileProps): ReactNode { +OperationSchema.File = function({ mode = 'directory' }: FileProps): ReactNode { const plugin = usePlugin() const pluginManager = usePluginManager() const oas = useOas() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() const factoryName = useOperationName({ type: 'type' }) const operation = useOperation() - const generator = new TypeGenerator(plugin.options, { oas, plugin, pluginManager }) + const generator = new SchemaGenerator(plugin.options, { oas, plugin, pluginManager }) const items = [ schemas.pathParams, @@ -127,14 +127,18 @@ Schema.File = function({ mode = 'directory' }: FileProps): ReactNode { path={file.path} meta={file.meta} > - - + {items.map(({ name, schema: object, ...options }, i) => { + return ( + + {mode === 'directory' + && } + + + + + ) + })} + {printCombinedSchema(factoryName, operation, schemas)} diff --git a/packages/swagger-ts/src/components/__snapshots__/Schema/pets.ts b/packages/swagger-ts/src/components/__snapshots__/Schema/pets.ts index b790d3918..09e8cf44e 100644 --- a/packages/swagger-ts/src/components/__snapshots__/Schema/pets.ts +++ b/packages/swagger-ts/src/components/__snapshots__/Schema/pets.ts @@ -1,12 +1,4 @@ -/** - * @description Null response - */ -export type CreatePets201 = any - -/** - * @description unexpected error - */ -export type CreatePetsError = Error +export type CreatePetsMutationResponse = any export type CreatePetsMutationRequest = { /** @@ -19,7 +11,16 @@ export type CreatePetsMutationRequest = { tag: string } -export type CreatePetsMutationResponse = any +/** + * @description Null response + */ +export type CreatePets201 = any + +/** + * @description unexpected error + */ +export type CreatePetsError = Error + export type CreatePetsMutation = { Response: CreatePetsMutationResponse Request: CreatePetsMutationRequest diff --git a/packages/swagger-ts/src/components/__snapshots__/Schema/showPetById.ts b/packages/swagger-ts/src/components/__snapshots__/Schema/showPetById.ts index 550537c34..4543dedcd 100644 --- a/packages/swagger-ts/src/components/__snapshots__/Schema/showPetById.ts +++ b/packages/swagger-ts/src/components/__snapshots__/Schema/showPetById.ts @@ -1,13 +1,3 @@ -/** - * @description Expected response to a valid request - */ -export type ShowPetById200 = Pet - -/** - * @description unexpected error - */ -export type ShowPetByIdError = Error - export type ShowPetByIdPathParams = { /** * @description The id of the pet to retrieve @@ -25,6 +15,17 @@ export type ShowPetByIdPathParams = { * @description Expected response to a valid request */ export type ShowPetByIdQueryResponse = Pet + +/** + * @description Expected response to a valid request + */ +export type ShowPetById200 = Pet + +/** + * @description unexpected error + */ +export type ShowPetByIdError = Error + export type ShowPetByIdQuery = { Response: ShowPetByIdQueryResponse PathParams: ShowPetByIdPathParams diff --git a/packages/swagger-ts/src/components/index.ts b/packages/swagger-ts/src/components/index.ts index 3706debdf..958969665 100644 --- a/packages/swagger-ts/src/components/index.ts +++ b/packages/swagger-ts/src/components/index.ts @@ -1,2 +1,2 @@ export { OasType } from './OasType.tsx' -export { Schema } from './Schema.tsx' +export { OperationSchema } from './OperationSchema.tsx' diff --git a/packages/swagger-ts/src/plugin.ts b/packages/swagger-ts/src/plugin.ts index a2c6c7aa2..812d6a265 100644 --- a/packages/swagger-ts/src/plugin.ts +++ b/packages/swagger-ts/src/plugin.ts @@ -6,11 +6,10 @@ import { renderTemplate } from '@kubb/core/utils' import { pluginName as swaggerPluginName } from '@kubb/swagger' import { OperationGenerator } from './OperationGenerator.tsx' -import { TypeBuilder } from './TypeBuilder.ts' +import { SchemaGenerator } from './SchemaGenerator.tsx' -import type { KubbFile, Plugin } from '@kubb/core' +import type { Plugin } from '@kubb/core' import type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger' -import type { OasTypes } from '@kubb/swagger/oas' import type { PluginOptions } from './types.ts' export const pluginName = 'swagger-ts' satisfies PluginOptions['name'] export const pluginKey: PluginOptions['key'] = [pluginName] satisfies PluginOptions['key'] @@ -41,7 +40,7 @@ export const definePlugin = createPlugin((options) => { oasType, enumType, enumSuffix, - // keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey) + // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey) usedEnumNames: {}, unknownType, }, @@ -86,60 +85,24 @@ export const definePlugin = createPlugin((options) => { const [swaggerPlugin]: [Plugin] = PluginManager.getDependedPlugins(this.plugins, [swaggerPluginName]) const oas = await swaggerPlugin.api.getOas() - - const schemas = await swaggerPlugin.api.getSchemas() const root = path.resolve(this.config.root, this.config.output.path) const mode = FileManager.getMode(path.resolve(root, output.path)) - const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager }) - builder.add( - Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })), + const schemaGenerator = new SchemaGenerator( + this.plugin.options, + { + oas, + pluginManager: this.pluginManager, + plugin: this.plugin, + contentType: swaggerPlugin.api.contentType, + include: undefined, + mode, + output: output.path, + }, ) - if (mode === 'directory') { - const mapFolderSchema = async ([name]: [string, OasTypes.SchemaObject]) => { - const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: 'file' })}.ts` as const - const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key }) - const { source, imports } = builder.build(name) - - if (!resolvedPath) { - return null - } - - return this.addFile({ - path: resolvedPath, - baseName, - source, - imports: imports.map(item => ({ ...item, root: resolvedPath })), - meta: { - pluginKey: this.plugin.key, - }, - }) - } - - const promises = Object.entries(schemas).map(mapFolderSchema) - - await Promise.all(promises) - } - - if (mode === 'file') { - const resolvedPath = this.resolvePath({ baseName: '', pluginKey: this.plugin.key }) - const { source } = builder.build() - - if (!resolvedPath) { - return - } - - await this.addFile({ - path: resolvedPath, - baseName: output.path as KubbFile.BaseName, - source, - imports: [], - meta: { - pluginKey: this.plugin.key, - }, - }) - } + const schemaFiles = await schemaGenerator.build() + await this.addFile(...schemaFiles) const operationGenerator = new OperationGenerator( this.plugin.options, @@ -155,8 +118,8 @@ export const definePlugin = createPlugin((options) => { }, ) - const files = await operationGenerator.build() - await this.addFile(...files) + const operationFiles = await operationGenerator.build() + await this.addFile(...operationFiles) }, async buildEnd() { if (this.config.output.write === false) { diff --git a/packages/swagger-zod/src/OperationGenerator.test.tsx b/packages/swagger-zod/src/OperationGenerator.test.tsx index 8a87d9841..e1072d568 100644 --- a/packages/swagger-zod/src/OperationGenerator.test.tsx +++ b/packages/swagger-zod/src/OperationGenerator.test.tsx @@ -41,8 +41,8 @@ describe('OperationGenerator', async () => { const operation = oas.operation('/pets', 'get') const operationShowById = oas.operation('/pets/{petId}', 'get') - const files = await og.get(operation, options) as KubbFile.File[] - const getShowByIdFiles = await og.get(operationShowById, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] + const getShowByIdFiles = await og.operation(operationShowById, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -77,7 +77,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pets', 'post') - const files = await og.post(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -108,7 +108,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pet/{petId}', 'delete') - const files = await og.delete(operation, options) as KubbFile.File[] + const files = await og.operation(operation, options) as KubbFile.File[] files.forEach(file => { expect(FileManager.getSource(file)).toMatchSnapshot() @@ -139,7 +139,7 @@ describe('OperationGenerator', async () => { }, ) const operation = oas.operation('/pet/{petId}', 'delete') - const files = await og.delete(operation, options) + const files = await og.operation(operation, options) expect(files).toMatchSnapshot() }) diff --git a/packages/swagger-zod/src/OperationGenerator.tsx b/packages/swagger-zod/src/OperationGenerator.tsx index 19d012cd5..04ff2c2ee 100644 --- a/packages/swagger-zod/src/OperationGenerator.tsx +++ b/packages/swagger-zod/src/OperationGenerator.tsx @@ -23,7 +23,7 @@ export class OperationGenerator extends Generator>({ logger: pluginManager.logger }) root.render( - this.getSchemas(...props)}> + this.getSchemas(...props)}> @@ -34,35 +34,21 @@ export class OperationGenerator extends Generator { - return this.operation(operation, options) + async get(): OperationMethodResult { + return null } - async post( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + + async post(): OperationMethodResult { + return null } - async put( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async put(): OperationMethodResult { + return null } - async patch( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async patch(): OperationMethodResult { + return null } - async delete( - operation: Operation, - options: PluginOptions['resolvedOptions'], - ): OperationMethodResult { - return this.operation(operation, options) + async delete(): OperationMethodResult { + return null } } diff --git a/packages/swagger-zod/src/ZodBuilder.ts b/packages/swagger-zod/src/ZodBuilder.ts index f67f4c615..0e8f11792 100644 --- a/packages/swagger-zod/src/ZodBuilder.ts +++ b/packages/swagger-zod/src/ZodBuilder.ts @@ -20,9 +20,10 @@ export class ZodBuilder extends OasBuilder { .filter((operationSchema) => (name ? operationSchema.name === name : true)) .sort(transformers.nameSorter) .map((operationSchema) => { - const generator = new ZodGenerator(this.options, this.context) + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const generator = new ZodGenerator(this.options, (this.context) as any) - const sources = generator.build(operationSchema) + const sources = generator.buildSource(operationSchema.name, operationSchema.schema, operationSchema) importMeta.push(...generator.imports) return { diff --git a/packages/swagger-zod/src/ZodGenerator.test.ts b/packages/swagger-zod/src/ZodGenerator.test.ts index 237da462e..8bd806aed 100644 --- a/packages/swagger-zod/src/ZodGenerator.test.ts +++ b/packages/swagger-zod/src/ZodGenerator.test.ts @@ -6,7 +6,7 @@ import { OasManager } from '@kubb/swagger' import { ZodGenerator } from './ZodGenerator.ts' import type { Plugin } from '@kubb/core' -import type { OasTypes } from '@kubb/swagger/oas' +import type { SchemaObject } from '@kubb/swagger/oas' import type { PluginOptions } from './types.ts' describe('ZodGenerator PetStore', async () => { @@ -23,10 +23,12 @@ describe('ZodGenerator PetStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pet as OasTypes.SchemaObject, name: 'Pet' }) + const node = generator.buildSource('Pet', schemas?.Pet as SchemaObject) expect(node).toMatchSnapshot() }) @@ -43,10 +45,12 @@ describe('ZodGenerator PetStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Pets as OasTypes.SchemaObject, name: 'Pets' }) + const node = generator.buildSource('Pets', schemas?.Pets as SchemaObject) expect(node).toMatchSnapshot() }) @@ -63,10 +67,12 @@ describe('ZodGenerator PetStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.OptionalPet as OasTypes.SchemaObject, name: 'OptionalPet' }) + const node = generator.buildSource('OptionalPet', schemas?.OptionalPet as SchemaObject) expect(node).toMatchSnapshot() }) @@ -84,10 +90,12 @@ describe('ZodGenerator PetStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.OptionalPet as OasTypes.SchemaObject, name: 'OptionalPet' }) + const node = generator.buildSource('OptionalPet', schemas?.OptionalPet as SchemaObject) expect(node).toMatchSnapshot() }) @@ -104,10 +112,12 @@ describe('ZodGenerator PetStore', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.PetArray as OasTypes.SchemaObject, name: 'PetArray' }) + const node = generator.buildSource('PetArray', schemas?.PetArray as SchemaObject) expect(node).toMatchSnapshot() }) @@ -127,62 +137,64 @@ describe('ZodGenerator constCases', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain const schemas = oas.getDefinition().components?.schemas! test('UuidSchema generates a string with uuid format constraint', async () => { - const schema = schemas['UuidSchema'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'UuidSchema' }) + const schema = schemas['UuidSchema'] as SchemaObject + const node = generator.buildSource('UuidSchema', schema) expect(node).toMatchSnapshot() }) test('NullableString zodifies correctly', async () => { - const schema = schemas?.['NullableString'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'NullableString' }) + const schema = schemas?.['NullableString'] as SchemaObject + const node = generator.buildSource('NullableString', schema) expect(node).toMatchSnapshot() }) test('NullableStringWithAnyOf results in union of string and null', async () => { - const schema = schemas['NullableStringWithAnyOf'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'NullableStringWithAnyOf' }) + const schema = schemas['NullableStringWithAnyOf'] as SchemaObject + const node = generator.buildSource('NullableStringWithAnyOf', schema) expect(node).toMatchSnapshot() }) test('NullableStringUuid zodifies correctly to a uuid or null', async () => { - const schema = schemas['NullableStringUuid'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'NullableStringUuid' }) + const schema = schemas['NullableStringUuid'] as SchemaObject + const node = generator.buildSource('NullableStringUuid', schema) expect(node).toMatchSnapshot() }) test('NullConst zodifies correctly', async () => { - const schema = schemas['NullConst'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'NullConst' }) + const schema = schemas['NullConst'] as SchemaObject + const node = generator.buildSource('NullConst', schema) expect(node).toMatchSnapshot() }) test('StringValueConst correctly generates zod literal', async () => { - const schema = schemas['StringValueConst'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'StringValueConst' }) + const schema = schemas['StringValueConst'] as SchemaObject + const node = generator.buildSource('StringValueConst', schema) expect(node).toMatchSnapshot() }) test('NumberValueConst correctly generates zod literal', async () => { - const schema = schemas['NumberValueConst'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'NumberValueConst' }) + const schema = schemas['NumberValueConst'] as SchemaObject + const node = generator.buildSource('NumberValueConst', schema) expect(node).toMatchSnapshot() }) test('MixedValueTypeConst generates zod literal value correctly, overriding the type constraint', async () => { - const schema = schemas['MixedValueTypeConst'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'MixedValueTypeConst' }) + const schema = schemas['MixedValueTypeConst'] as SchemaObject + const node = generator.buildSource('MixedValueTypeConst', schema) expect(node).toMatchSnapshot() }) @@ -204,10 +216,12 @@ describe('ZodGenerator lazy', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Example as OasTypes.SchemaObject, name: 'Example' }) + const node = generator.buildSource('Example', schemas?.Example as SchemaObject) expect(node).toMatchSnapshot() }) @@ -227,18 +241,20 @@ describe('ZodGenerator enums', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas test('generate x-enum-varnames types', async () => { - const node = generator.build({ schema: schemas?.['enumVarNames.Type'] as OasTypes.SchemaObject, name: 'enumVarNames' }) + const node = generator.buildSource('enumVarNames', schemas?.['enumVarNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) test('generate x-enumNames types', async () => { - const node = generator.build({ schema: schemas?.['enumNames.Type'] as OasTypes.SchemaObject, name: 'enumNames' }) + const node = generator.buildSource('enumNames', schemas?.['enumNames.Type'] as SchemaObject) expect(node).toMatchSnapshot() }) @@ -260,10 +276,12 @@ describe('ZodGenerator recursive', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) const schemas = oas.getDefinition().components?.schemas - const node = generator.build({ schema: schemas?.Example as OasTypes.SchemaObject, name: 'Example' }) + const node = generator.buildSource('Example', schemas?.Example as SchemaObject) expect(node).toMatchSnapshot() }) @@ -283,13 +301,15 @@ describe('ZodGenerator anyof', async () => { oas, pluginManager: mockedPluginManager, plugin: {} as Plugin, + contentType: undefined, + include: undefined, }) // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain const schemas = oas.getDefinition().components?.schemas! test('anyof with 2 objects', async () => { - const schema = schemas['test'] as OasTypes.SchemaObject - const node = generator.build({ schema, name: 'test' }) + const schema = schemas['test'] as SchemaObject + const node = generator.buildSource('test', schema) expect(node).toMatchSnapshot() }) diff --git a/packages/swagger-zod/src/ZodGenerator.ts b/packages/swagger-zod/src/ZodGenerator.ts index 310c18ed5..fb8db7396 100644 --- a/packages/swagger-zod/src/ZodGenerator.ts +++ b/packages/swagger-zod/src/ZodGenerator.ts @@ -4,36 +4,36 @@ import { pluginKey as swaggerTypeScriptPluginKey } from '@kubb/swagger-ts' import { pluginKey } from './plugin.ts' import { zodParser } from './zodParser.tsx' -import type { SchemaGeneratorBuildOptions } from '@kubb/swagger' +import type { Schema as SchemaType, SchemaGeneratorBuildOptions } from '@kubb/swagger' +import type { SchemaObject } from '@kubb/swagger/oas' export class ZodGenerator extends SchemaGenerator { - build({ - schema, - name: baseName, + async schema() { + return null + } + + getSource(name: string, schemas: SchemaType[], { keysToOmit, operation, description, - }: SchemaGeneratorBuildOptions): string[] { + required, + }: SchemaGeneratorBuildOptions & { required?: boolean } = {}): string[] { const texts: string[] = [] - const input = this.getTypeFromSchema(schema, baseName) - const withTypeAnnotation = this.options.typed && !operation // used for this.options.typed - const typeName = this.context.pluginManager.resolveName({ name: baseName, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) + const typeName = this.context.pluginManager.resolveName({ name, pluginKey: swaggerTypeScriptPluginKey, type: 'type' }) - // hack so Params will be optional when needed - const required = Array.isArray(schema?.required) ? !!schema.required.length : !!schema?.required - const optional = !required && !!baseName.includes('Params') + const optional = !required && !!name.includes('Params') if (optional) { - input.push({ + schemas.push({ keyword: schemaKeywords.optional, }) } - const output = zodParser(input, { + const output = zodParser(schemas, { keysToOmit, - name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'function' }), + name: this.context.pluginManager.resolveName({ name: name, pluginKey, type: 'function' }), description, typeName: withTypeAnnotation ? typeName @@ -41,14 +41,15 @@ export class ZodGenerator extends SchemaGenerator { }) if (withTypeAnnotation && typeName) { - const typeFileName = this.context.pluginManager.resolveName({ name: baseName, pluginKey: swaggerTypeScriptPluginKey, type: 'file' }) + const typeFileName = this.context.pluginManager.resolveName({ name: name, pluginKey: swaggerTypeScriptPluginKey, type: 'file' }) const typePath = this.context.pluginManager.resolvePath({ baseName: typeFileName, pluginKey: swaggerTypeScriptPluginKey }) if (typePath) { this.imports.push({ ref: { propertyName: typeName, - originalName: baseName, + originalName: name, + path: typePath, pluginKey: swaggerTypeScriptPluginKey, }, path: typePath, @@ -61,4 +62,12 @@ export class ZodGenerator extends SchemaGenerator { return texts } + buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] { + const schemas = this.buildSchemas(schema, name) + + // hack so Params will be optional when needed + const required = Array.isArray(schema?.required) ? !!schema.required.length : !!schema?.required + + return this.getSource(name, schemas, { ...options, required }) + } } diff --git a/packages/swagger-zod/src/components/Schema.test.tsx b/packages/swagger-zod/src/components/Schema.test.tsx index bf4698c43..aafa394c9 100644 --- a/packages/swagger-zod/src/components/Schema.test.tsx +++ b/packages/swagger-zod/src/components/Schema.test.tsx @@ -48,7 +48,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> @@ -68,7 +68,7 @@ describe('', async () => { const Component = () => { return ( - og.getSchemas(...props)}> + og.getSchemas(...props)}> diff --git a/packages/swagger-zod/src/components/Schema.tsx b/packages/swagger-zod/src/components/Schema.tsx index cd0b6db6e..2e6563868 100644 --- a/packages/swagger-zod/src/components/Schema.tsx +++ b/packages/swagger-zod/src/components/Schema.tsx @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/ban-types */ import { Editor, File, usePlugin, usePluginManager } from '@kubb/react' import { OasParser } from '@kubb/swagger/components' -import { useGetOperationFile, useOas, useSchemas } from '@kubb/swagger/hooks' +import { useGetOperationFile, useOas, useOperationSchemas } from '@kubb/swagger/hooks' import { ZodGenerator } from '../ZodGenerator.ts' @@ -28,10 +28,10 @@ Schema.File = function({ mode = 'directory' }: FileProps): ReactNode { const pluginManager = usePluginManager() const oas = useOas() - const schemas = useSchemas() + const schemas = useOperationSchemas() const file = useGetOperationFile() - const generator = new ZodGenerator(plugin.options, { oas, plugin, pluginManager }) + const generator = new ZodGenerator(plugin.options, { oas, plugin, pluginManager, contentType: undefined, include: undefined }) const items = [ schemas.pathParams, diff --git a/packages/swagger-zodios/src/OperationGenerator.tsx b/packages/swagger-zodios/src/OperationGenerator.tsx index bd9431e86..a91568522 100644 --- a/packages/swagger-zodios/src/OperationGenerator.tsx +++ b/packages/swagger-zodios/src/OperationGenerator.tsx @@ -16,7 +16,7 @@ export class OperationGenerator extends Generator>({ logger: pluginManager.logger }) root.render( - this.getSchemas(...props)}> + this.getSchemas(...props)}> , { @@ -27,6 +27,10 @@ export class OperationGenerator extends Generator { + return null + } + async get(): OperationMethodResult { return null } diff --git a/packages/swagger/mocks/schemas.ts b/packages/swagger/mocks/schemas.ts index 414670246..a22eabed2 100644 --- a/packages/swagger/mocks/schemas.ts +++ b/packages/swagger/mocks/schemas.ts @@ -89,6 +89,7 @@ const basic: Array<{ name: string; schema: Schema }> = [ keyword: schemaKeywords.ref, args: { name: 'Pet', + path: './pet.ts', }, }, }, @@ -152,7 +153,7 @@ const basic: Array<{ name: string; schema: Schema }> = [ schema: { keyword: schemaKeywords.array, args: { - items: [{ keyword: schemaKeywords.ref, args: { name: 'Pet' } }], + items: [{ keyword: schemaKeywords.ref, args: { name: 'Pet', path: './pet.ts' } }], }, }, }, @@ -187,7 +188,7 @@ const basic: Array<{ name: string; schema: Schema }> = [ keyword: schemaKeywords.object, args: { properties: {}, - additionalProperties: [{ keyword: schemaKeywords.ref, args: { name: 'Pet' } }], + additionalProperties: [{ keyword: schemaKeywords.ref, args: { name: 'Pet', path: './Pet.ts' } }], }, }, }, diff --git a/packages/swagger/src/OperationGenerator.test.ts b/packages/swagger/src/OperationGenerator.test.ts index 425a029d8..528bc17f8 100644 --- a/packages/swagger/src/OperationGenerator.test.ts +++ b/packages/swagger/src/OperationGenerator.test.ts @@ -3,10 +3,15 @@ import { OperationGenerator } from './OperationGenerator.ts' import type { KubbFile, PluginManager } from '@kubb/core' import type { Plugin } from '@kubb/core' +import type { FileMeta } from '@kubb/swagger-ts' import type { Operation } from './oas/index.ts' +import type { OperationMethodResult } from './OperationGenerator.ts' import type { Resolver } from './types.ts' class DummyOperationGenerator extends OperationGenerator { + operation(): OperationMethodResult { + return Promise.resolve(null) + } resolve(_operation: Operation): Resolver { return { baseName: 'baseName.ts', diff --git a/packages/swagger/src/OperationGenerator.ts b/packages/swagger/src/OperationGenerator.ts index 98c5c8f9c..be892118f 100644 --- a/packages/swagger/src/OperationGenerator.ts +++ b/packages/swagger/src/OperationGenerator.ts @@ -331,9 +331,9 @@ export abstract class OperationGenerator< const { oas } = this.context const paths = oas.getPaths() - this.operationsByMethod = Object.keys(paths).reduce( - (acc, path) => { - const methods = Object.keys(paths[path]!) as HttpMethod[] + this.operationsByMethod = Object.entries(paths).reduce( + (acc, [path, method]) => { + const methods = Object.keys(method) as HttpMethod[] methods.forEach((method) => { const operation = oas.operation(path, method) @@ -368,10 +368,14 @@ export abstract class OperationGenerator< methods.forEach((method) => { const { operation } = this.operationsByMethod[path]![method] const options = this.#getOptions(operation, method) - const promise = this.#methods[method]!.call(this, operation, { ...this.options, ...options }) + const promiseMethod = this.#methods[method]!.call(this, operation, { ...this.options, ...options }) + const promiseOperation = this.operation.call(this, operation, { ...this.options, ...options }) - if (promise) { - acc.push(promise) + if (promiseMethod) { + acc.push(promiseMethod) + } + if (promiseOperation) { + acc.push(promiseOperation) } }) @@ -390,6 +394,11 @@ export abstract class OperationGenerator< return files.flat().filter(Boolean) } + /** + * Operation + */ + abstract operation(operation: Operation, options: TOptions): OperationMethodResult + /** * GET */ diff --git a/packages/swagger/src/SchemaGenerator.ts b/packages/swagger/src/SchemaGenerator.ts index 13af37957..b86aa270b 100644 --- a/packages/swagger/src/SchemaGenerator.ts +++ b/packages/swagger/src/SchemaGenerator.ts @@ -3,13 +3,16 @@ import transformers, { pascalCase } from '@kubb/core/transformers' import { getUniqueName } from '@kubb/core/utils' import { getSchemaFactory } from './utils/getSchemaFactory.ts' +import { getSchemas } from './utils/getSchemas.ts' import { isReference } from './utils/isReference.ts' import { isKeyword, schemaKeywords } from './SchemaMapper.ts' -import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core' -import type { Oas, OasTypes, OpenAPIV3, SchemaObject } from './oas/index.ts' +import type { KubbFile, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core' +import type { Oas, OpenAPIV3, SchemaObject } from './oas/index.ts' import type { Schema, SchemaKeywordMapper, SchemaMapper } from './SchemaMapper.ts' -import type { ImportMeta, OperationSchema, Refs } from './types.ts' +import type { ContentType, ImportMeta, OperationSchema, Refs } from './types.ts' + +export type SchemaMethodResult = Promise | Array> | null> type Context = { oas: Oas @@ -18,6 +21,10 @@ type Context = { * Current plugin */ plugin: Plugin + include?: Array<'schemas' | 'responses' | 'requestBodies'> + contentType?: ContentType + mode?: KubbFile.Mode + output?: string } export type SchemaGeneratorOptions = { @@ -38,66 +45,90 @@ export type SchemaGeneratorOptions = { * TODO TODO add docs * @beta */ - schema?: (schema: OasTypes.SchemaObject | undefined, baseName?: string) => Schema[] | undefined + schema?: (schema: SchemaObject | undefined, baseName?: string) => Schema[] | undefined } } -export type SchemaGeneratorBuildOptions = OperationSchema +export type SchemaGeneratorBuildOptions = Omit export abstract class SchemaGenerator< TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, + TFileMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase, > extends Generator> { // Collect the types of all referenced schemas so we can export them later refs: Refs = {} + /** + * @deprecated use ref in schema instead(it has path) + */ imports: ImportMeta[] = [] // Keep track of already used type aliases #usedAliasNames: Record = {} - + #usedEnumNames = this.options.usedEnumNames || {} + /** + * Cached schemas + */ + #schemasCache: Record = {} /** * Creates a type node from a given schema. * Delegates to getBaseTypeFromSchema internally and * optionally adds a union with null. */ - getTypeFromSchema(schema: SchemaObject, baseName?: string): Schema[] { - return this.options.transformers.schema?.(schema, baseName) || this.#getBaseTypeFromSchema(schema, baseName) || [] + buildSchemas(schema: SchemaObject | undefined, baseName?: string): Schema[] { + return this.options.transformers.schema?.(schema, baseName) || this.#parseSchemaObject(schema, baseName) || [] + } + + deepSearch(schemas: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] { + return SchemaGenerator.deepSearch(schemas, keyword) } - static deepSearch(items: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] { + static deepSearch(schemas: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] { const foundItems: SchemaKeywordMapper[T][] = [] - items?.forEach(item => { - if (item.keyword === keyword) { - foundItems.push(item as SchemaKeywordMapper[T]) + schemas?.forEach(schema => { + if (schema.keyword === keyword) { + foundItems.push(schema as SchemaKeywordMapper[T]) } - if (item.keyword === schemaKeywords.object) { - const subItem = item as SchemaKeywordMapper['object'] + if (schema.keyword === schemaKeywords.object) { + const subItem = schema as SchemaKeywordMapper['object'] Object.values(subItem.args?.properties || {}).forEach(entrySchema => { foundItems.push(...SchemaGenerator.deepSearch(entrySchema, keyword)) }) + + Object.values(subItem.args?.additionalProperties || {}).forEach(entrySchema => { + foundItems.push(...SchemaGenerator.deepSearch([entrySchema], keyword)) + }) } - if (item.keyword === schemaKeywords.array) { - const subItem = item as SchemaKeywordMapper['array'] + if (schema.keyword === schemaKeywords.array) { + const subItem = schema as SchemaKeywordMapper['array'] subItem.args.items.forEach(entrySchema => { foundItems.push(...SchemaGenerator.deepSearch([entrySchema], keyword)) }) } - if (item.keyword === schemaKeywords.and) { - const subItem = item as SchemaKeywordMapper['and'] + if (schema.keyword === schemaKeywords.and) { + const subItem = schema as SchemaKeywordMapper['and'] + + subItem.args.forEach(entrySchema => { + foundItems.push(...SchemaGenerator.deepSearch([entrySchema], keyword)) + }) + } + + if (schema.keyword === schemaKeywords.tuple) { + const subItem = schema as SchemaKeywordMapper['tuple'] subItem.args.forEach(entrySchema => { foundItems.push(...SchemaGenerator.deepSearch([entrySchema], keyword)) }) } - if (item.keyword === schemaKeywords.tuple) { - const subItem = item as SchemaKeywordMapper['tuple'] + if (schema.keyword === schemaKeywords.union) { + const subItem = schema as SchemaKeywordMapper['union'] subItem.args.forEach(entrySchema => { foundItems.push(...SchemaGenerator.deepSearch([entrySchema], keyword)) @@ -116,12 +147,10 @@ export abstract class SchemaGenerator< return schemaKeywords.unknown } - #usedEnumNames = this.options.usedEnumNames || {} - /** * Recursively creates a type literal with the given props. */ - #getTypeFromProperties(baseSchema?: OasTypes.SchemaObject, baseName?: string): Schema[] { + #parseProperties(baseSchema?: SchemaObject, baseName?: string): Schema[] { const properties = baseSchema?.properties || {} const additionalProperties = baseSchema?.additionalProperties const required = baseSchema?.required @@ -135,7 +164,7 @@ export abstract class SchemaGenerator< const isRequired = Array.isArray(required) ? required && required.includes(name) : !!required const nullable = (schema.nullable ?? schema['x-nullable']) ?? false - validationFunctions.push(...this.getTypeFromSchema(schema, resolvedName)) + validationFunctions.push(...this.buildSchemas(schema, resolvedName)) if (!isRequired && nullable) { validationFunctions.push({ keyword: schemaKeywords.nullish }) @@ -154,7 +183,7 @@ export abstract class SchemaGenerator< if (additionalProperties) { additionalPropertieschemas = additionalProperties === true ? [{ keyword: this.#unknownReturn }] - : this.getTypeFromSchema(additionalProperties as OasTypes.SchemaObject) + : this.buildSchemas(additionalProperties as SchemaObject) } members.push({ keyword: schemaKeywords.object, args: { properties: propertiesSchemas, additionalProperties: additionalPropertieschemas } }) @@ -173,17 +202,18 @@ export abstract class SchemaGenerator< const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey: this.context.plugin.key, 'type': 'function' }) if (ref) { - return [{ keyword: schemaKeywords.ref, args: { name: ref.propertyName } }] + return [{ keyword: schemaKeywords.ref, args: { name: ref.propertyName, path: ref.path } }] } + const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey: this.context.plugin.key, type: 'file' }) + const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey: this.context.plugin.key }) + ref = this.refs[$ref] = { propertyName, originalName, + path, } - const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey: this.context.plugin.key, type: 'file' }) - const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey: this.context.plugin.key }) - if (path) { this.imports.push({ ref, @@ -192,10 +222,10 @@ export abstract class SchemaGenerator< }) } - return [{ keyword: schemaKeywords.ref, args: { name: ref.propertyName } }] + return [{ keyword: schemaKeywords.ref, args: { name: ref.propertyName, path: ref?.path } }] } - #getParsedSchema(schema?: SchemaObject) { + #getParsedSchemaObject(schema?: SchemaObject) { const parsedSchema = getSchemaFactory(this.context.oas)(schema) return parsedSchema } @@ -204,8 +234,8 @@ export abstract class SchemaGenerator< * This is the very core of the OpenAPI to TS conversion - it takes a * schema and returns the appropriate type. */ - #getBaseTypeFromSchema(_schema: SchemaObject | undefined, baseName?: string): Schema[] { - const { schema, version } = this.#getParsedSchema(_schema) + #parseSchemaObject(_schema: SchemaObject | undefined, baseName?: string): Schema[] { + const { schema, version } = this.#getParsedSchemaObject(_schema) if (!schema) { return [{ keyword: this.#unknownReturn }] @@ -256,7 +286,7 @@ export abstract class SchemaGenerator< keyword: schemaKeywords.union, args: schema.oneOf .map((item) => { - return item && this.getTypeFromSchema(item as SchemaObject, baseName)[0] + return item && this.buildSchemas(item as SchemaObject, baseName)[0] }) .filter(Boolean) .filter((item) => { @@ -264,7 +294,7 @@ export abstract class SchemaGenerator< }), } if (schemaWithoutOneOf.properties) { - return [...this.getTypeFromSchema(schemaWithoutOneOf, baseName), union, ...baseItems] + return [...this.buildSchemas(schemaWithoutOneOf, baseName), union, ...baseItems] } return [union, ...baseItems] @@ -278,7 +308,7 @@ export abstract class SchemaGenerator< keyword: schemaKeywords.union, args: schema.anyOf .map((item) => { - return item && this.getTypeFromSchema(item as SchemaObject, baseName)[0] + return item && this.buildSchemas(item as SchemaObject, baseName)[0] }) .filter(Boolean) .filter((item) => { @@ -297,7 +327,7 @@ export abstract class SchemaGenerator< }), } if (schemaWithoutAnyOf.properties) { - return [...this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union, ...baseItems] + return [...this.buildSchemas(schemaWithoutAnyOf, baseName), union, ...baseItems] } return [union, ...baseItems] @@ -310,7 +340,7 @@ export abstract class SchemaGenerator< keyword: schemaKeywords.and, args: schema.allOf .map((item) => { - return item && this.getTypeFromSchema(item as SchemaObject, baseName)[0] + return item && this.buildSchemas(item as SchemaObject, baseName)[0] }) .filter(Boolean) .filter((item) => { @@ -322,7 +352,7 @@ export abstract class SchemaGenerator< return [ { ...and, - args: [...(and.args || []), ...this.getTypeFromSchema(schemaWithoutAllOf, baseName)], + args: [...(and.args || []), ...this.buildSchemas(schemaWithoutAllOf, baseName)], }, ...baseItems, ] @@ -406,14 +436,14 @@ export abstract class SchemaGenerator< } if ('prefixItems' in schema) { - const prefixItems = schema.prefixItems as OasTypes.SchemaObject[] + const prefixItems = schema.prefixItems as SchemaObject[] return [ { keyword: schemaKeywords.tuple, args: prefixItems .map((item) => { - return this.getTypeFromSchema(item, baseName)[0] + return this.buildSchemas(item, baseName)[0] }) .filter(Boolean), }, @@ -423,7 +453,7 @@ export abstract class SchemaGenerator< if ('items' in schema) { const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined - const items = this.getTypeFromSchema(schema.items as OasTypes.SchemaObject, baseName) + const items = this.buildSchemas(schema.items as SchemaObject, baseName) return [{ keyword: schemaKeywords.array, @@ -436,7 +466,7 @@ export abstract class SchemaGenerator< } if (schema.properties || schema.additionalProperties) { - return [...this.#getTypeFromProperties(schema, baseName), ...baseItems] + return [...this.#parseProperties(schema, baseName), ...baseItems] } if (version === '3.1' && 'const' in schema) { @@ -457,7 +487,7 @@ export abstract class SchemaGenerator< const [type, nullable] = schema.type as Array return [ - ...this.getTypeFromSchema( + ...this.buildSchemas( { ...schema, type, @@ -524,7 +554,43 @@ export abstract class SchemaGenerator< return [{ keyword: this.#unknownReturn }] } - abstract build( - options: SchemaGeneratorBuildOptions, + async build(): Promise>> { + const { oas, contentType, include } = this.context + + const object = getSchemas({ oas, contentType, includes: include }) + + const promises = Object.entries(object).reduce( + (acc, [name, schema]) => { + const promiseOperation = this.schema.call(this, name, schema) + + if (promiseOperation) { + acc.push(promiseOperation) + } + + return acc + }, + [] as SchemaMethodResult[], + ) + + const files = await Promise.all(promises) + + // using .flat because schemaGenerator[method] can return a array of files or just one file + return files.flat().filter(Boolean) + } + + /** + * Schema + */ + abstract schema(name: string, object: SchemaObject): SchemaMethodResult + + abstract getSource(name: string, schemas: Schema[], options?: SchemaGeneratorBuildOptions): string[] + + /** + * Returns the source, in the future it an return a react component + */ + abstract buildSource( + name: string, + object: SchemaObject | undefined, + options?: SchemaGeneratorBuildOptions, ): string[] } diff --git a/packages/swagger/src/SchemaMapper.ts b/packages/swagger/src/SchemaMapper.ts index 9ba220071..8bcbf4673 100644 --- a/packages/swagger/src/SchemaMapper.ts +++ b/packages/swagger/src/SchemaMapper.ts @@ -1,3 +1,5 @@ +import type { KubbFile } from '@kubb/core' + export type SchemaKeywordMapper = { object: { keyword: 'object'; args: { properties: { [x: string]: Schema[] }; additionalProperties: Schema[]; strict?: boolean } } strict: { keyword: 'strict' } @@ -25,7 +27,7 @@ export type SchemaKeywordMapper = { and: { keyword: 'and'; args: Schema[] } const: { keyword: 'const'; args: { name: string | number; format: 'string' | 'number'; value?: string | number } } union: { keyword: 'union'; args: Schema[] } - ref: { keyword: 'ref'; args: { name: string } } + ref: { keyword: 'ref'; args: { name: string; path: KubbFile.OptionalPath } } lazy: { keyword: 'lazy' } matches: { keyword: 'matches'; args?: string } boolean: { keyword: 'boolean' } diff --git a/packages/swagger/src/components/Oas.tsx b/packages/swagger/src/components/Oas.tsx index f4a302ab2..e415d21c8 100644 --- a/packages/swagger/src/components/Oas.tsx +++ b/packages/swagger/src/components/Oas.tsx @@ -1,33 +1,33 @@ import { createContext } from '@kubb/react' -import { OasParser } from './OasParser.tsx' import { Operation } from './Operation.tsx' +import { Schema } from './Schema.tsx' import type { KubbNode } from '@kubb/react' import type { Oas as OasType, Operation as OperationType } from '../oas/index.ts' import type { OperationSchemas } from '../types.ts' -export type GetSchemas = (operation: OperationType, statusCode?: string | number) => OperationSchemas +export type GetOperationSchemas = (operation: OperationType, statusCode?: string | number) => OperationSchemas type Props = { oas: OasType operations?: OperationType[] - getSchemas?: GetSchemas + getOperationSchemas?: GetOperationSchemas children?: KubbNode } type OasContextProps = { oas?: OasType operations?: OperationType[] - getSchemas?: GetSchemas + getOperationSchemas?: GetOperationSchemas } const OasContext = createContext({}) -export function Oas({ oas, children, operations, getSchemas }: Props): KubbNode { - return {children} +export function Oas({ oas, children, operations, getOperationSchemas }: Props): KubbNode { + return {children} } Oas.Context = OasContext Oas.Operation = Operation -Oas.Parser = OasParser +Oas.Schema = Schema diff --git a/packages/swagger/src/components/OasParser.tsx b/packages/swagger/src/components/OasParser.tsx index c04f4b7bc..0645067aa 100644 --- a/packages/swagger/src/components/OasParser.tsx +++ b/packages/swagger/src/components/OasParser.tsx @@ -18,6 +18,9 @@ type Props = { // parser?: any } +/** + * @deprecated find better solution + */ export function OasParser({ name, items, mode, generator, isTypeOnly }: Props): KubbNode { const file = useFile() @@ -28,7 +31,7 @@ export function OasParser({ name, items, mode, generator, isTypeOnly }: Props): .filter((operationSchema) => (name ? operationSchema.name === name : true)) .sort(transformers.nameSorter) .map((operationSchema) => { - const sources = generator.build(operationSchema) + const sources = generator.buildSource(operationSchema.name, operationSchema.schema, operationSchema) importMeta.push(...generator.imports) return { diff --git a/packages/swagger/src/components/Schema.tsx b/packages/swagger/src/components/Schema.tsx new file mode 100644 index 000000000..f39f3eb3d --- /dev/null +++ b/packages/swagger/src/components/Schema.tsx @@ -0,0 +1,140 @@ +import { createContext, Editor, File, usePlugin, usePluginManager } from '@kubb/react' + +import { useSchema } from '../hooks/useSchema.ts' +import { schemaKeywords } from '../SchemaMapper.ts' + +import type { KubbFile } from '@kubb/core' +import type { KubbNode } from '@kubb/react' +import type { ReactNode } from 'react' +import type { SchemaObject } from '../oas/index.ts' +import type { SchemaGenerator, SchemaGeneratorBuildOptions } from '../SchemaGenerator.ts' +import type { Schema as SchemaType } from '../SchemaMapper.ts' +import type { PluginOptions } from '../types.ts' + +export type SchemaContextProps = { + name: string + object?: SchemaObject + generator?: SchemaGenerator + schemas: SchemaType[] +} + +type Props = { + name: string + object?: SchemaObject + generator: SchemaGenerator + children?: KubbNode +} + +const SchemaContext = createContext({ name: 'unknown', schemas: [] }) + +export function Schema({ name, object, generator, children }: Props): KubbNode { + const schemas = generator.buildSchemas(object, name) + + return ( + + {children} + + ) +} + +type FileProps = { + mode: KubbFile.Mode | undefined + isTypeOnly?: boolean + output: string | undefined +} + +Schema.File = function({ output, isTypeOnly, mode = 'directory' }: FileProps): ReactNode { + const plugin = usePlugin() + + const pluginManager = usePluginManager() + const { name } = useSchema() + + if (mode === 'file') { + const baseName = output as KubbFile.BaseName + const resolvedPath = pluginManager.resolvePath({ baseName: '', pluginKey: plugin.key }) + + if (!resolvedPath) { + return null + } + + return ( + + + + + + + + ) + } + + const baseName = `${pluginManager.resolveName({ name, pluginKey: plugin.key, type: 'file' })}.ts` as const + const resolvedPath = pluginManager.resolvePath({ baseName, pluginKey: plugin.key }) + + if (!resolvedPath) { + return null + } + + return ( + + + + + + + + + ) +} + +type SchemaImportsProps = { + root: string + isTypeOnly?: boolean +} + +Schema.Imports = ({ root, isTypeOnly }: SchemaImportsProps): ReactNode => { + const { generator, schemas } = useSchema() + + const refs = generator.deepSearch(schemas, schemaKeywords.ref) + + return ( + <> + {refs?.map((ref, i) => { + if (!ref.args.path) { + return undefined + } + return + }).filter(Boolean)} + + ) +} + +type SchemaSourceProps = { + options?: SchemaGeneratorBuildOptions +} + +Schema.Source = ({ options }: SchemaSourceProps): ReactNode => { + const { name, generator, schemas } = useSchema() + + const source = generator.getSource(name, schemas, options) + + return ( + <> + {source} +
+ + ) +} +Schema.Context = SchemaContext diff --git a/packages/swagger/src/components/index.ts b/packages/swagger/src/components/index.ts index 09ce9be22..d1cb17fac 100644 --- a/packages/swagger/src/components/index.ts +++ b/packages/swagger/src/components/index.ts @@ -1,3 +1,4 @@ export { Oas } from './Oas.tsx' export { OasParser } from './OasParser.tsx' export { Operation } from './Operation.tsx' +export { Schema } from './Schema.tsx' diff --git a/packages/swagger/src/hooks/index.ts b/packages/swagger/src/hooks/index.ts index 03970167c..72dac60ef 100644 --- a/packages/swagger/src/hooks/index.ts +++ b/packages/swagger/src/hooks/index.ts @@ -2,4 +2,5 @@ export { useOas } from './useOas.ts' export { useGetOperationFile, useOperation, useOperationName } from './useOperation.ts' export { useOperationHelpers } from './useOperationHelpers.ts' export { useOperations } from './useOperations.ts' -export { useSchemas } from './useSchemas.ts' +export { useOperationSchemas } from './useOperationSchemas.ts' +export { useSchema } from './useSchema.ts' diff --git a/packages/swagger/src/hooks/useOperationHelpers.ts b/packages/swagger/src/hooks/useOperationHelpers.ts index 5e23f2211..7cff508d5 100644 --- a/packages/swagger/src/hooks/useOperationHelpers.ts +++ b/packages/swagger/src/hooks/useOperationHelpers.ts @@ -3,7 +3,7 @@ import { useContext, usePluginManager } from '@kubb/react' import { Oas } from '../components/Oas.tsx' import type { KubbFile, Plugin, ResolveNameParams } from '@kubb/core' -import type { GetSchemas } from '../components/Oas.tsx' +import type { GetOperationSchemas } from '../components/Oas.tsx' import type { Operation as OperationType } from '../oas/index.ts' type FileMeta = KubbFile.FileMetaBase & { @@ -15,7 +15,7 @@ type FileMeta = KubbFile.FileMetaBase & { type UseOperationHelpersResult = { getName: (operation: OperationType, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string getFile: (operation: OperationType, params: { pluginKey: Plugin['key']; extName?: KubbFile.Extname }) => KubbFile.File - getSchemas: GetSchemas + getSchemas: GetOperationSchemas } /** @@ -23,7 +23,7 @@ type UseOperationHelpersResult = { */ export function useOperationHelpers(): UseOperationHelpersResult { const pluginManager = usePluginManager() - const { getSchemas } = useContext(Oas.Context) + const { getOperationSchemas: getSchemas } = useContext(Oas.Context) const getName: UseOperationHelpersResult['getName'] = (operation, { pluginKey, type }) => { return pluginManager.resolveName({ name: operation.getOperationId(), pluginKey, type }) diff --git a/packages/swagger/src/hooks/useSchemas.ts b/packages/swagger/src/hooks/useOperationSchemas.ts similarity index 67% rename from packages/swagger/src/hooks/useSchemas.ts rename to packages/swagger/src/hooks/useOperationSchemas.ts index d0c2ecac8..be432dcfe 100644 --- a/packages/swagger/src/hooks/useSchemas.ts +++ b/packages/swagger/src/hooks/useOperationSchemas.ts @@ -6,10 +6,10 @@ import { Operation } from '../components/Operation.tsx' import type { OperationSchemas } from '../types.ts' /** - * When no schemas is set it will call `getSchemas` of `useOas` based on the current operation. + * When no schemas is set it will call `getOperationSchemas` of `useOas` based on the current operation. */ -export function useSchemas(): OperationSchemas { - const { getSchemas } = useContext(Oas.Context) +export function useOperationSchemas(): OperationSchemas { + const { getOperationSchemas: getSchemas } = useContext(Oas.Context) const { schemas, operation } = useContext(Operation.Context) if (getSchemas && operation) { diff --git a/packages/swagger/src/hooks/useSchema.ts b/packages/swagger/src/hooks/useSchema.ts new file mode 100644 index 000000000..2dfa4378a --- /dev/null +++ b/packages/swagger/src/hooks/useSchema.ts @@ -0,0 +1,23 @@ +import { useContext } from '@kubb/react' + +import { Schema } from '../components/Schema.tsx' + +import type { SchemaContextProps } from '../components/Schema.tsx' +import type { SchemaGenerator } from '../SchemaGenerator.ts' + +type UseSchemaResult = Omit & { + generator: SchemaGenerator +} + +/** + * `useSchema` will return the current `schema properties` + */ +export function useSchema(): UseSchemaResult { + const props = useContext(Schema.Context) + + if (!props.generator) { + throw new Error('Generator is not defined') + } + + return props as UseSchemaResult +} diff --git a/packages/swagger/src/index.ts b/packages/swagger/src/index.ts index 46f86ebd0..d7d37ef6d 100644 --- a/packages/swagger/src/index.ts +++ b/packages/swagger/src/index.ts @@ -6,6 +6,7 @@ export type { GetOperationGeneratorOptions, OperationMethodResult } from './Oper export { OperationGenerator } from './OperationGenerator.ts' export { definePlugin, pluginKey, pluginName } from './plugin.ts' export type { SchemaGeneratorBuildOptions, SchemaGeneratorOptions } from './SchemaGenerator.ts' +export type { SchemaMethodResult } from './SchemaGenerator.ts' export { SchemaGenerator } from './SchemaGenerator.ts' export type { Schema, SchemaKeyword, SchemaKeywordBase, SchemaKeywordMapper, SchemaMapper } from './SchemaMapper.ts' export { isKeyword, schemaKeywords } from './SchemaMapper.ts' diff --git a/packages/swagger/src/oas/index.ts b/packages/swagger/src/oas/index.ts index ff2ea895f..18a632b30 100644 --- a/packages/swagger/src/oas/index.ts +++ b/packages/swagger/src/oas/index.ts @@ -9,6 +9,7 @@ export type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' export type SchemaObject = OasTypes.SchemaObject & { 'x-nullable'?: boolean + $ref?: string } export const HttpMethods = { diff --git a/packages/swagger/src/types.ts b/packages/swagger/src/types.ts index 534a2d849..4c18c6e76 100644 --- a/packages/swagger/src/types.ts +++ b/packages/swagger/src/types.ts @@ -57,7 +57,7 @@ export type Options = { * @example import a type(swagger-ts) for a mock file(swagger-faker) */ -export type Ref = { propertyName: string; originalName: string; pluginKey?: Plugin['key'] } +export type Ref = { propertyName: string; originalName: string; path: KubbFile.OptionalPath; pluginKey?: Plugin['key'] } export type Refs = Record export type Resolver = { @@ -74,7 +74,7 @@ export type OperationSchema = { * Converted name, contains already `PathParams`, `QueryParams`, ... */ name: string - schema: SchemaObject & { $ref?: string } + schema: SchemaObject operation?: Operation /** * OperationName in PascalCase, only being used in OperationGenerator