Skip to content

Commit

Permalink
chore: e2e strict-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Sep 22, 2024
1 parent 4a96ae0 commit e4d554e
Show file tree
Hide file tree
Showing 63 changed files with 131 additions and 186 deletions.
4 changes: 3 additions & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"sourceMap": true,
"strictNullChecks": true,
"jsx": "react-jsx",
"outDir": "es",
"outDir": "dist",
"experimentalDecorators": true,
"skipLibCheck": true,
"baseUrl": ".",
Expand All @@ -15,6 +15,8 @@
"allowJs": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"alwaysStrict": true,
"strict": true,
"paths": {
"@kubb/cli": ["../packages/cli/src/index.ts"],
"@kubb/config-biome": ["../packages/config/config-biome/src/index.ts"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWRMutation from 'swr/mutation'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts'

/**
Expand All @@ -29,14 +27,14 @@ async function addPet(data: AddPetMutationRequest, config: Partial<RequestConfig
*/
export function useAddPet(
options: {
mutation?: SWRMutationConfiguration<AddPetMutationResponse, AddPet405>
mutation?: Parameters<typeof useSWRMutation<AddPetMutationResponse, AddPet405, any>>[2]
client?: Partial<RequestConfig<AddPetMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/pet'] as const
return useSWRMutation<AddPetMutationResponse, AddPet405, Key>(
return useSWRMutation<AddPetMutationResponse, AddPet405, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return addPet(data, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWRMutation from 'swr/mutation'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts'

/**
Expand Down Expand Up @@ -31,14 +29,14 @@ export function useDeletePet(
petId: DeletePetPathParams['petId'],
headers?: DeletePetHeaderParams,
options: {
mutation?: SWRMutationConfiguration<DeletePetMutationResponse, DeletePet400>
mutation?: Parameters<typeof useSWRMutation<DeletePetMutationResponse, DeletePet400, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/pet/${petId}`] as const
return useSWRMutation<DeletePetMutationResponse, DeletePet400, Key>(
return useSWRMutation<DeletePetMutationResponse, DeletePet400, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url) => {
return deletePet(petId, headers, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWR from 'swr'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.ts'
import type { Key, SWRConfiguration } from 'swr'
import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts'

/**
Expand Down Expand Up @@ -37,14 +36,14 @@ export function findPetsByStatusQueryOptions(params?: FindPetsByStatusQueryParam
export function useFindPetsByStatus(
params?: FindPetsByStatusQueryParams,
options: {
query?: SWRConfiguration<FindPetsByStatusQueryResponse, FindPetsByStatus400>
query?: Parameters<typeof useSWR<FindPetsByStatusQueryResponse, FindPetsByStatus400, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/pet/findByStatus', params] as const
return useSWR<FindPetsByStatusQueryResponse, FindPetsByStatus400, Key>(shouldFetch ? swrKey : null, {
return useSWR<FindPetsByStatusQueryResponse, FindPetsByStatus400, typeof swrKey | null>(shouldFetch ? swrKey : null, {
...findPetsByStatusQueryOptions(params, config),
...queryOptions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
FindPetsByTagsHeaderParams,
FindPetsByTags400,
} from '../../../models/ts/petController/FindPetsByTags.ts'
import type { Key, SWRConfiguration } from 'swr'
import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts'

/**
Expand Down Expand Up @@ -44,14 +43,14 @@ export function useFindPetsByTags(
headers: FindPetsByTagsHeaderParams,
params?: FindPetsByTagsQueryParams,
options: {
query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/pet/findByTags', params] as const
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, typeof swrKey | null>(shouldFetch ? swrKey : null, {
...findPetsByTagsQueryOptions(headers, params, config),
...queryOptions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWR from 'swr'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.ts'
import type { Key, SWRConfiguration } from 'swr'
import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts'

/**
Expand Down Expand Up @@ -36,14 +35,14 @@ export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], con
export function useGetPetById(
petId: GetPetByIdPathParams['petId'],
options: {
query?: SWRConfiguration<GetPetByIdQueryResponse, GetPetById400 | GetPetById404>
query?: Parameters<typeof useSWR<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/pet/${petId}`] as const
return useSWR<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, Key>(shouldFetch ? swrKey : null, {
return useSWR<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, typeof swrKey | null>(shouldFetch ? swrKey : null, {
...getPetByIdQueryOptions(petId, config),
...queryOptions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import type {
UpdatePet404,
UpdatePet405,
} from '../../../models/ts/petController/UpdatePet.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { updatePetMutationResponseSchema } from '../../../zod/petController/updatePetSchema.ts'

/**
Expand All @@ -35,14 +33,14 @@ async function updatePet(data: UpdatePetMutationRequest, config: Partial<Request
*/
export function useUpdatePet(
options: {
mutation?: SWRMutationConfiguration<UpdatePetMutationResponse, UpdatePet400 | UpdatePet404 | UpdatePet405>
mutation?: Parameters<typeof useSWRMutation<UpdatePetMutationResponse, UpdatePet400 | UpdatePet404 | UpdatePet405, any>>[2]
client?: Partial<RequestConfig<UpdatePetMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/pet'] as const
return useSWRMutation<UpdatePetMutationResponse, UpdatePet400 | UpdatePet404 | UpdatePet405, Key>(
return useSWRMutation<UpdatePetMutationResponse, UpdatePet400 | UpdatePet404 | UpdatePet405, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return updatePet(data, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import type {
UpdatePetWithFormQueryParams,
UpdatePetWithForm405,
} from '../../../models/ts/petController/UpdatePetWithForm.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { updatePetWithFormMutationResponseSchema } from '../../../zod/petController/updatePetWithFormSchema.ts'

/**
Expand All @@ -34,14 +32,14 @@ export function useUpdatePetWithForm(
petId: UpdatePetWithFormPathParams['petId'],
params?: UpdatePetWithFormQueryParams,
options: {
mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/pet/${petId}`, params] as const
return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(
return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url) => {
return updatePetWithForm(petId, params, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import type {
UploadFilePathParams,
UploadFileQueryParams,
} from '../../../models/ts/petController/UploadFile.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { uploadFileMutationResponseSchema } from '../../../zod/petController/uploadFileSchema.ts'

/**
Expand Down Expand Up @@ -41,14 +39,14 @@ export function useUploadFile(
petId: UploadFilePathParams['petId'],
params?: UploadFileQueryParams,
options: {
mutation?: SWRMutationConfiguration<UploadFileMutationResponse, unknown>
mutation?: Parameters<typeof useSWRMutation<UploadFileMutationResponse, Error, any>>[2]
client?: Partial<RequestConfig<UploadFileMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/pet/${petId}/uploadImage`, params] as const
return useSWRMutation<UploadFileMutationResponse, unknown, Key>(
return useSWRMutation<UploadFileMutationResponse, Error, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return uploadFile(petId, data, params, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import type {
CreatePetsQueryParams,
CreatePetsHeaderParams,
} from '../../../models/ts/petsController/CreatePets.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { createPetsMutationResponseSchema } from '../../../zod/petsController/createPetsSchema.ts'

/**
Expand Down Expand Up @@ -44,14 +42,14 @@ export function useCreatePets(
headers: CreatePetsHeaderParams,
params?: CreatePetsQueryParams,
options: {
mutation?: SWRMutationConfiguration<CreatePetsMutationResponse, unknown>
mutation?: Parameters<typeof useSWRMutation<CreatePetsMutationResponse, Error, any>>[2]
client?: Partial<RequestConfig<CreatePetsMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/pets/${uuid}`, params] as const
return useSWRMutation<CreatePetsMutationResponse, unknown, Key>(
return useSWRMutation<CreatePetsMutationResponse, Error, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return createPets(uuid, data, headers, params, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWRMutation from 'swr/mutation'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { createUserMutationResponseSchema } from '../../../zod/userController/createUserSchema.ts'

/**
Expand All @@ -29,14 +27,14 @@ async function createUser(data?: CreateUserMutationRequest, config: Partial<Requ
*/
export function useCreateUser(
options: {
mutation?: SWRMutationConfiguration<CreateUserMutationResponse, unknown>
mutation?: Parameters<typeof useSWRMutation<CreateUserMutationResponse, Error, any>>[2]
client?: Partial<RequestConfig<CreateUserMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/user'] as const
return useSWRMutation<CreateUserMutationResponse, unknown, Key>(
return useSWRMutation<CreateUserMutationResponse, Error, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return createUser(data, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type {
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
} from '../../../models/ts/userController/CreateUsersWithListInput.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { createUsersWithListInputMutationResponseSchema } from '../../../zod/userController/createUsersWithListInputSchema.ts'

/**
Expand Down Expand Up @@ -35,14 +33,14 @@ async function createUsersWithListInput(
*/
export function useCreateUsersWithListInput(
options: {
mutation?: SWRMutationConfiguration<CreateUsersWithListInputMutationResponse, unknown>
mutation?: Parameters<typeof useSWRMutation<CreateUsersWithListInputMutationResponse, Error, any>>[2]
client?: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/user/createWithList'] as const
return useSWRMutation<CreateUsersWithListInputMutationResponse, unknown, Key>(
return useSWRMutation<CreateUsersWithListInputMutationResponse, Error, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url, { arg: data }) => {
return createUsersWithListInput(data, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWRMutation from 'swr/mutation'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../../models/ts/userController/DeleteUser.ts'
import type { Key } from 'swr'
import type { SWRMutationConfiguration } from 'swr/mutation'
import { deleteUserMutationResponseSchema } from '../../../zod/userController/deleteUserSchema.ts'

/**
Expand All @@ -29,14 +27,14 @@ async function deleteUser(username: DeleteUserPathParams['username'], config: Pa
export function useDeleteUser(
username: DeleteUserPathParams['username'],
options: {
mutation?: SWRMutationConfiguration<DeleteUserMutationResponse, DeleteUser400 | DeleteUser404>
mutation?: Parameters<typeof useSWRMutation<DeleteUserMutationResponse, DeleteUser400 | DeleteUser404, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/user/${username}`] as const
return useSWRMutation<DeleteUserMutationResponse, DeleteUser400 | DeleteUser404, Key>(
return useSWRMutation<DeleteUserMutationResponse, DeleteUser400 | DeleteUser404, typeof swrKey | null>(
shouldFetch ? swrKey : null,
async (_url) => {
return deleteUser(username, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
GetUserByName400,
GetUserByName404,
} from '../../../models/ts/userController/GetUserByName.ts'
import type { Key, SWRConfiguration } from 'swr'
import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts'

/**
Expand Down Expand Up @@ -39,14 +38,14 @@ export function getUserByNameQueryOptions(username: GetUserByNamePathParams['use
export function useGetUserByName(
username: GetUserByNamePathParams['username'],
options: {
query?: SWRConfiguration<GetUserByNameQueryResponse, GetUserByName400 | GetUserByName404>
query?: Parameters<typeof useSWR<GetUserByNameQueryResponse, GetUserByName400 | GetUserByName404, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = [`/user/${username}`] as const
return useSWR<GetUserByNameQueryResponse, GetUserByName400 | GetUserByName404, Key>(shouldFetch ? swrKey : null, {
return useSWR<GetUserByNameQueryResponse, GetUserByName400 | GetUserByName404, typeof swrKey | null>(shouldFetch ? swrKey : null, {
...getUserByNameQueryOptions(username, config),
...queryOptions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts'
import useSWR from 'swr'
import type { RequestConfig } from '../../../../swr-client.ts'
import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser.ts'
import type { Key, SWRConfiguration } from 'swr'
import { loginUserQueryResponseSchema } from '../../../zod/userController/loginUserSchema.ts'

/**
Expand Down Expand Up @@ -35,14 +34,14 @@ export function loginUserQueryOptions(params?: LoginUserQueryParams, config: Par
export function useLoginUser(
params?: LoginUserQueryParams,
options: {
query?: SWRConfiguration<LoginUserQueryResponse, LoginUser400>
query?: Parameters<typeof useSWR<LoginUserQueryResponse, LoginUser400, any>>[2]
client?: Partial<RequestConfig>
shouldFetch?: boolean
} = {},
) {
const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
const swrKey = ['/user/login', params] as const
return useSWR<LoginUserQueryResponse, LoginUser400, Key>(shouldFetch ? swrKey : null, {
return useSWR<LoginUserQueryResponse, LoginUser400, typeof swrKey | null>(shouldFetch ? swrKey : null, {
...loginUserQueryOptions(params, config),
...queryOptions,
})
Expand Down
Loading

0 comments on commit e4d554e

Please sign in to comment.