Skip to content

Commit

Permalink
Merge branch 'main' into fix/817
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Feb 18, 2024
2 parents c98b0f8 + 69897f5 commit 7143aa6
Show file tree
Hide file tree
Showing 154 changed files with 222 additions and 1,223 deletions.
6 changes: 6 additions & 0 deletions .changeset/sharp-tables-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@kubb/swagger-ts": patch
"@kubb/swagger": patch
---

AllOf when used in responses
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import type {
CreatePetsPathParams,
CreatePetsQueryParams,
CreatePetsHeaderParams,
CreatePets201,
CreatePetsError,
} from '../../../models/ts/petsController/CreatePets'
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'

type CreatePetsClient = typeof client<CreatePetsMutationResponse, CreatePets201 | CreatePetsError, CreatePetsMutationRequest>
type CreatePetsClient = typeof client<CreatePetsMutationResponse, never, CreatePetsMutationRequest>
type CreatePets = {
data: CreatePetsMutationResponse
error: CreatePets201 | CreatePetsError
error: never
request: CreatePetsMutationRequest
pathParams: CreatePetsPathParams
queryParams: CreatePetsQueryParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import client from '../../../../tanstack-query-client.ts'
import { useMutation } from '@tanstack/react-query'
import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../../../models/ts/userController/CreateUser'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser'
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'

type CreateUserClient = typeof client<CreateUserMutationResponse, CreateUserError, CreateUserMutationRequest>
type CreateUserClient = typeof client<CreateUserMutationResponse, never, CreateUserMutationRequest>
type CreateUser = {
data: CreateUserMutationResponse
error: CreateUserError
error: never
request: CreateUserMutationRequest
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ import { useMutation } from '@tanstack/react-query'
import type {
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
CreateUsersWithListInputError,
} from '../../../models/ts/userController/CreateUsersWithListInput'
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'

type CreateUsersWithListInputClient = typeof client<
CreateUsersWithListInputMutationResponse,
CreateUsersWithListInputError,
CreateUsersWithListInputMutationRequest
>
type CreateUsersWithListInputClient = typeof client<CreateUsersWithListInputMutationResponse, never, CreateUsersWithListInputMutationRequest>
type CreateUsersWithListInput = {
data: CreateUsersWithListInputMutationResponse
error: CreateUsersWithListInputError
error: never
request: CreateUsersWithListInputMutationRequest
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema'
import client from '../../../../tanstack-query-client.ts'
import { useQuery, useInfiniteQuery } from '@tanstack/react-query'
import type { LogoutUserQueryResponse, LogoutUserError } from '../../../models/ts/userController/LogoutUser'
import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser'
import type {
UseBaseQueryOptions,
UseQueryResult,
Expand All @@ -12,10 +12,10 @@ import type {
InfiniteData,
} from '@tanstack/react-query'

type LogoutUserClient = typeof client<LogoutUserQueryResponse, LogoutUserError, never>
type LogoutUserClient = typeof client<LogoutUserQueryResponse, never, never>
type LogoutUser = {
data: LogoutUserQueryResponse
error: LogoutUserError
error: never
request: never
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import client from '../../../../tanstack-query-client.ts'
import { useMutation } from '@tanstack/react-query'
import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../../../models/ts/userController/UpdateUser'
import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser'
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'

type UpdateUserClient = typeof client<UpdateUserMutationResponse, UpdateUserError, UpdateUserMutationRequest>
type UpdateUserClient = typeof client<UpdateUserMutationResponse, never, UpdateUserMutationRequest>
type UpdateUser = {
data: UpdateUserMutationResponse
error: UpdateUserError
error: never
request: UpdateUserMutationRequest
pathParams: UpdateUserPathParams
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import type {
CreatePetsPathParams,
CreatePetsQueryParams,
CreatePetsHeaderParams,
CreatePets201,
CreatePetsError,
} from '../../../models/ts/petsController/CreatePets'

type CreatePetsClient = typeof client<CreatePetsMutationResponse, CreatePets201 | CreatePetsError, CreatePetsMutationRequest>
type CreatePetsClient = typeof client<CreatePetsMutationResponse, never, CreatePetsMutationRequest>
type CreatePets = {
data: CreatePetsMutationResponse
error: CreatePets201 | CreatePetsError
error: never
request: CreatePetsMutationRequest
pathParams: CreatePetsPathParams
queryParams: CreatePetsQueryParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import useSWRMutation from 'swr/mutation'
import client from '../../../../swr-client.ts'
import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation'
import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../../../models/ts/userController/CreateUser'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser'

type CreateUserClient = typeof client<CreateUserMutationResponse, CreateUserError, CreateUserMutationRequest>
type CreateUserClient = typeof client<CreateUserMutationResponse, never, CreateUserMutationRequest>
type CreateUser = {
data: CreateUserMutationResponse
error: CreateUserError
error: never
request: CreateUserMutationRequest
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation
import type {
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
CreateUsersWithListInputError,
} from '../../../models/ts/userController/CreateUsersWithListInput'

type CreateUsersWithListInputClient = typeof client<
CreateUsersWithListInputMutationResponse,
CreateUsersWithListInputError,
CreateUsersWithListInputMutationRequest
>
type CreateUsersWithListInputClient = typeof client<CreateUsersWithListInputMutationResponse, never, CreateUsersWithListInputMutationRequest>
type CreateUsersWithListInput = {
data: CreateUsersWithListInputMutationResponse
error: CreateUsersWithListInputError
error: never
request: CreateUsersWithListInputMutationRequest
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import useSWR from 'swr'
import client from '../../../../swr-client.ts'
import type { SWRConfiguration, SWRResponse } from 'swr'
import type { LogoutUserQueryResponse, LogoutUserError } from '../../../models/ts/userController/LogoutUser'
import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser'

type LogoutUserClient = typeof client<LogoutUserQueryResponse, LogoutUserError, never>
type LogoutUserClient = typeof client<LogoutUserQueryResponse, never, never>
type LogoutUser = {
data: LogoutUserQueryResponse
error: LogoutUserError
error: never
request: never
pathParams: never
queryParams: never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import useSWRMutation from 'swr/mutation'
import client from '../../../../swr-client.ts'
import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation'
import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../../../models/ts/userController/UpdateUser'
import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser'

type UpdateUserClient = typeof client<UpdateUserMutationResponse, UpdateUserError, UpdateUserMutationRequest>
type UpdateUserClient = typeof client<UpdateUserMutationResponse, never, UpdateUserMutationRequest>
type UpdateUser = {
data: UpdateUserMutationResponse
error: UpdateUserError
error: never
request: UpdateUserMutationRequest
pathParams: UpdateUserPathParams
queryParams: never
Expand Down
18 changes: 0 additions & 18 deletions examples/advanced/src/gen/mocks/petsController/createCreatePets.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import { faker } from '@faker-js/faker'
import { createPetNotFound } from '../createPetNotFound'
import type {
CreatePets201,
CreatePetsError,
CreatePetsHeaderParams,
CreatePetsMutationRequest,
CreatePetsMutationResponse,
CreatePetsPathParams,
CreatePetsQueryParams,
} from '../../models/ts/petsController/CreatePets'

/**
* @description Null response
*/

export function createCreatePets201(override?: NonNullable<Partial<CreatePets201>>): NonNullable<CreatePets201> {
return undefined
}

export function createCreatePetsHeaderParams(override: NonNullable<Partial<CreatePetsHeaderParams>> = {}): NonNullable<CreatePetsHeaderParams> {
return {
...{ 'X-EXAMPLE': faker.helpers.arrayElement<any>([`ONE`, `TWO`, `THREE`]) },
Expand Down Expand Up @@ -49,10 +38,3 @@ export function createCreatePetsQueryParams(override: NonNullable<Partial<Create
...override,
}
}
/**
* @description unexpected error
*/

export function createCreatePetsError(override?: NonNullable<Partial<CreatePetsError>>): NonNullable<CreatePetsError> {
return createPetNotFound(override)
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { createUser } from '../createUser'
import type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/ts/userController/CreateUser'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/ts/userController/CreateUser'

export function createCreateUserMutationResponse(override?: NonNullable<Partial<CreateUserMutationResponse>>): NonNullable<CreateUserMutationResponse> {
return undefined
}
/**
* @description successful operation
*/

export function createCreateUserError(override?: NonNullable<Partial<CreateUserError>>): NonNullable<CreateUserError> {
return createUser(override)
}
/**
* @description Created user object
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import { faker } from '@faker-js/faker'
import { createUser } from '../createUser'
import type {
CreateUsersWithListInputError,
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
} from '../../models/ts/userController/CreateUsersWithListInput'

/**
* @description successful operation
*/

export function createCreateUsersWithListInputError(
override?: NonNullable<Partial<CreateUsersWithListInputError>>,
): NonNullable<CreateUsersWithListInputError> {
return undefined
}
import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/ts/userController/CreateUsersWithListInput'

export function createCreateUsersWithListInputMutationRequest(
override: NonNullable<Partial<CreateUsersWithListInputMutationRequest>> = [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import type { LogoutUserError, LogoutUserQueryResponse } from '../../models/ts/userController/LogoutUser'

/**
* @description successful operation
*/

export function createLogoutUserError(override?: NonNullable<Partial<LogoutUserError>>): NonNullable<LogoutUserError> {
return undefined
}
import type { LogoutUserQueryResponse } from '../../models/ts/userController/LogoutUser'

export function createLogoutUserQueryResponse(override?: NonNullable<Partial<LogoutUserQueryResponse>>): NonNullable<LogoutUserQueryResponse> {
return undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { faker } from '@faker-js/faker'
import { createUser } from '../createUser'
import type { UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/ts/userController/UpdateUser'

/**
* @description successful operation
*/

export function createUpdateUserError(override?: NonNullable<Partial<UpdateUserError>>): NonNullable<UpdateUserError> {
return undefined
}
import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/ts/userController/UpdateUser'

export function createUpdateUserMutationResponse(override?: NonNullable<Partial<UpdateUserMutationResponse>>): NonNullable<UpdateUserMutationResponse> {
return undefined
Expand Down
13 changes: 0 additions & 13 deletions examples/advanced/src/gen/models/ts/petsController/CreatePets.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import type { PetNotFound } from '../PetNotFound'

/**
* @description Null response
*/
export type CreatePets201 = any | null

export const CreatePetsHeaderParamsXExample = {
'ONE': 'ONE',
'TWO': 'TWO',
Expand Down Expand Up @@ -47,16 +40,10 @@ export type CreatePetsQueryParams = {
*/
offset?: number
} | undefined

/**
* @description unexpected error
*/
export type CreatePetsError = PetNotFound
export type CreatePetsMutation = {
Response: CreatePetsMutationResponse
Request: CreatePetsMutationRequest
PathParams: CreatePetsPathParams
QueryParams: CreatePetsQueryParams
HeaderParams: CreatePetsHeaderParams
Errors: CreatePets201 | CreatePetsError
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ import type { User } from '../User'

export type CreateUserMutationResponse = any | null

/**
* @description successful operation
*/
export type CreateUserError = User

/**
* @description Created user object
*/
export type CreateUserMutationRequest = User
export type CreateUserMutation = {
Response: CreateUserMutationResponse
Request: CreateUserMutationRequest
Errors: CreateUserError
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import type { User } from '../User'

/**
* @description successful operation
*/
export type CreateUsersWithListInputError = any | null

export type CreateUsersWithListInputMutationRequest = User[]

/**
Expand All @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User
export type CreateUsersWithListInputMutation = {
Response: CreateUsersWithListInputMutationResponse
Request: CreateUsersWithListInputMutationRequest
Errors: CreateUsersWithListInputError
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/**
* @description successful operation
*/
export type LogoutUserError = any | null

export type LogoutUserQueryResponse = any | null
export type LogoutUserQuery = {
Response: LogoutUserQueryResponse
Errors: LogoutUserError
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import type { User } from '../User'

/**
* @description successful operation
*/
export type UpdateUserError = any | null

export type UpdateUserMutationResponse = any | null

export type UpdateUserPathParams = {
Expand All @@ -23,5 +18,4 @@ export type UpdateUserMutation = {
Response: UpdateUserMutationResponse
Request: UpdateUserMutationRequest
PathParams: UpdateUserPathParams
Errors: UpdateUserError
}
10 changes: 0 additions & 10 deletions examples/advanced/src/gen/zod/petsController/createPetsSchema.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { z } from 'zod'
import { petNotFoundSchema } from '../petNotFoundSchema'

/**
* @description Null response
*/
export const createPets201Schema = z.any()
export const createPetsHeaderParamsSchema = z.object({ 'X-EXAMPLE': z.enum([`ONE`, `TWO`, `THREE`]).describe(`Header parameters`) })
export const createPetsMutationRequestSchema = z.object({ 'name': z.string(), 'tag': z.string() })
export const createPetsMutationResponseSchema = z.any()
export const createPetsPathParamsSchema = z.object({ 'uuid': z.string().describe(`UUID`) })
export const createPetsQueryParamsSchema = z.object({ 'offset': z.number().describe(`Offset`).optional() }).optional()

/**
* @description unexpected error
*/
export const createPetsErrorSchema = z.lazy(() => petNotFoundSchema)
Loading

0 comments on commit 7143aa6

Please sign in to comment.