diff --git a/samples/hono/hono-with-fetch-client/next-app/app/gen/pets/pets.msw.ts b/samples/hono/hono-with-fetch-client/next-app/app/gen/pets/pets.msw.ts index a8519a9c8..42d0e10e1 100644 --- a/samples/hono/hono-with-fetch-client/next-app/app/gen/pets/pets.msw.ts +++ b/samples/hono/hono-with-fetch-client/next-app/app/gen/pets/pets.msw.ts @@ -14,16 +14,16 @@ export const getListPetsResponseMock = (): Pets => (_, i) => i + 1, ).map(() => ({ id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.word.sample(), + name: faker.string.alpha(20), + tag: faker.string.alpha(20), })); export const getCreatePetsResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.word.sample(), + name: faker.string.alpha(20), + tag: faker.string.alpha(20), ...overrideResponse, }); @@ -31,8 +31,8 @@ export const getUpdatePetsResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.word.sample(), + name: faker.string.alpha(20), + tag: faker.string.alpha(20), ...overrideResponse, }); @@ -40,8 +40,8 @@ export const getShowPetByIdResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.word.sample(), + name: faker.string.alpha(20), + tag: faker.string.alpha(20), ...overrideResponse, }); diff --git a/samples/next-app-with-fetch/app/gen/pets/pets.msw.ts b/samples/next-app-with-fetch/app/gen/pets/pets.msw.ts index 8ba59da21..4a60ca4dc 100644 --- a/samples/next-app-with-fetch/app/gen/pets/pets.msw.ts +++ b/samples/next-app-with-fetch/app/gen/pets/pets.msw.ts @@ -73,7 +73,7 @@ export const getListPetsResponseMock = (): Pets => faker.helpers.arrayElement([ { ...getListPetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -87,12 +87,12 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getListPetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -106,8 +106,8 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]), ); @@ -173,7 +173,7 @@ export const getCreatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getCreatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -187,12 +187,12 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getCreatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -206,8 +206,8 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -272,7 +272,7 @@ export const getUpdatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getUpdatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -286,12 +286,12 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getUpdatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -305,8 +305,8 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -371,7 +371,7 @@ export const getShowPetByIdResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getShowPetByIdResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -385,12 +385,12 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getShowPetByIdResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -404,8 +404,8 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); diff --git a/samples/react-app-with-swr/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.msw.ts b/samples/react-app-with-swr/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.msw.ts index 85f749fbc..20cc15d85 100644 --- a/samples/react-app-with-swr/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.msw.ts +++ b/samples/react-app-with-swr/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.msw.ts @@ -13,7 +13,7 @@ export const getListPetsResponseMock = (): Pets => { length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1, ).map(() => ({ - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: (() => faker.number.int({ min: 1, max: 99999 }))(), name: (() => faker.person.lastName())(), @@ -23,7 +23,7 @@ export const getListPetsResponseMock = (): Pets => export const getCreatePetsResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), name: (() => faker.person.lastName())(), diff --git a/samples/react-app-with-swr/fetch-client/src/api/endpoints/swaggerPetstore.msw.ts b/samples/react-app-with-swr/fetch-client/src/api/endpoints/swaggerPetstore.msw.ts index 7c06390f2..43cee6d59 100644 --- a/samples/react-app-with-swr/fetch-client/src/api/endpoints/swaggerPetstore.msw.ts +++ b/samples/react-app-with-swr/fetch-client/src/api/endpoints/swaggerPetstore.msw.ts @@ -13,32 +13,32 @@ export const getListPetsResponseMock = (): Pets => { length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1, ).map(() => ({ - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), })); export const getCreatePetsResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), ...overrideResponse, }); export const getShowPetByIdResponseMock = ( overrideResponse: Partial = {}, ): Pet => ({ - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), ...overrideResponse, }); diff --git a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index 09ad5fffe..9e7d31a62 100644 --- a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -689,12 +689,14 @@ export function useListPetsSuspenseInfinite< export const createPets = ( createPetsBody: CreatePetsBody, version: number = 1, + signal?: AbortSignal, ) => { return customInstance({ url: `/v${version}/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/react-query/custom-client/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/react-query/custom-client/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index 12bef98a9..75cd4c4ba 100644 --- a/samples/react-query/custom-client/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/react-query/custom-client/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -135,12 +135,17 @@ export const useCreatePetsHook = () => { const createPets = useCustomClient(); return useCallback( - (createPetsBody: BodyType, version: number = 1) => { + ( + createPetsBody: BodyType, + version: number = 1, + signal?: AbortSignal, + ) => { return createPets({ url: `/v${version}/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }, [createPets], diff --git a/samples/react-query/custom-fetch/src/gen/pets/pets.msw.ts b/samples/react-query/custom-fetch/src/gen/pets/pets.msw.ts index 8ba59da21..4a60ca4dc 100644 --- a/samples/react-query/custom-fetch/src/gen/pets/pets.msw.ts +++ b/samples/react-query/custom-fetch/src/gen/pets/pets.msw.ts @@ -73,7 +73,7 @@ export const getListPetsResponseMock = (): Pets => faker.helpers.arrayElement([ { ...getListPetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -87,12 +87,12 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getListPetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -106,8 +106,8 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]), ); @@ -173,7 +173,7 @@ export const getCreatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getCreatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -187,12 +187,12 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getCreatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -206,8 +206,8 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -272,7 +272,7 @@ export const getUpdatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getUpdatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -286,12 +286,12 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getUpdatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -305,8 +305,8 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -371,7 +371,7 @@ export const getShowPetByIdResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getShowPetByIdResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -385,12 +385,12 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getShowPetByIdResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -404,8 +404,8 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); diff --git a/samples/react-query/form-data-mutator/endpoints.ts b/samples/react-query/form-data-mutator/endpoints.ts index 4eadd6a18..d4b83bf00 100644 --- a/samples/react-query/form-data-mutator/endpoints.ts +++ b/samples/react-query/form-data-mutator/endpoints.ts @@ -109,12 +109,16 @@ export function useListPets< /** * @summary Create a pet */ -export const createPets = (createPetsBody: CreatePetsBody) => { +export const createPets = ( + createPetsBody: CreatePetsBody, + signal?: AbortSignal, +) => { return customInstance({ url: `/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/react-query/form-data/endpoints.ts b/samples/react-query/form-data/endpoints.ts index 4eadd6a18..d4b83bf00 100644 --- a/samples/react-query/form-data/endpoints.ts +++ b/samples/react-query/form-data/endpoints.ts @@ -109,12 +109,16 @@ export function useListPets< /** * @summary Create a pet */ -export const createPets = (createPetsBody: CreatePetsBody) => { +export const createPets = ( + createPetsBody: CreatePetsBody, + signal?: AbortSignal, +) => { return customInstance({ url: `/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/react-query/form-url-encoded-mutator/endpoints.ts b/samples/react-query/form-url-encoded-mutator/endpoints.ts index 5163d374f..5702c76a9 100644 --- a/samples/react-query/form-url-encoded-mutator/endpoints.ts +++ b/samples/react-query/form-url-encoded-mutator/endpoints.ts @@ -110,12 +110,16 @@ export function useListPets< /** * @summary Create a pet */ -export const createPets = (createPetsBody: CreatePetsBody) => { +export const createPets = ( + createPetsBody: CreatePetsBody, + signal?: AbortSignal, +) => { return customInstance({ url: `/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/react-query/form-url-encoded/endpoints.ts b/samples/react-query/form-url-encoded/endpoints.ts index 4eadd6a18..d4b83bf00 100644 --- a/samples/react-query/form-url-encoded/endpoints.ts +++ b/samples/react-query/form-url-encoded/endpoints.ts @@ -109,12 +109,16 @@ export function useListPets< /** * @summary Create a pet */ -export const createPets = (createPetsBody: CreatePetsBody) => { +export const createPets = ( + createPetsBody: CreatePetsBody, + signal?: AbortSignal, +) => { return customInstance({ url: `/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/react-query/hook-mutator/endpoints.ts b/samples/react-query/hook-mutator/endpoints.ts index 1a3d2d9bd..c70dd8a60 100644 --- a/samples/react-query/hook-mutator/endpoints.ts +++ b/samples/react-query/hook-mutator/endpoints.ts @@ -118,12 +118,13 @@ export const useCreatePetsHook = () => { const createPets = useCustomInstance(); return useCallback( - (createPetsBody: CreatePetsBody) => { + (createPetsBody: CreatePetsBody, signal?: AbortSignal) => { return createPets({ url: `/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }, [createPets], diff --git a/samples/svelte-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/svelte-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index 24765f70e..ea8525b99 100644 --- a/samples/svelte-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/svelte-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -122,12 +122,14 @@ export function createListPets< export const createPets = ( createPetsBody: CreatePetsBody, version: number = 1, + signal?: AbortSignal, ) => { return customInstance({ url: `/v${version}/pets`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; diff --git a/samples/svelte-query/custom-fetch/src/gen/pets/pets.msw.ts b/samples/svelte-query/custom-fetch/src/gen/pets/pets.msw.ts index 8ba59da21..4a60ca4dc 100644 --- a/samples/svelte-query/custom-fetch/src/gen/pets/pets.msw.ts +++ b/samples/svelte-query/custom-fetch/src/gen/pets/pets.msw.ts @@ -73,7 +73,7 @@ export const getListPetsResponseMock = (): Pets => faker.helpers.arrayElement([ { ...getListPetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -87,12 +87,12 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getListPetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -106,8 +106,8 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]), ); @@ -173,7 +173,7 @@ export const getCreatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getCreatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -187,12 +187,12 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getCreatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -206,8 +206,8 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -272,7 +272,7 @@ export const getUpdatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getUpdatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -286,12 +286,12 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getUpdatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -305,8 +305,8 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -371,7 +371,7 @@ export const getShowPetByIdResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getShowPetByIdResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -385,12 +385,12 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getShowPetByIdResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -404,8 +404,8 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); diff --git a/samples/swr-with-zod/src/gen/endpoints/pets/pets.msw.ts b/samples/swr-with-zod/src/gen/endpoints/pets/pets.msw.ts index be39ba140..05125521a 100644 --- a/samples/swr-with-zod/src/gen/endpoints/pets/pets.msw.ts +++ b/samples/swr-with-zod/src/gen/endpoints/pets/pets.msw.ts @@ -73,7 +73,7 @@ export const getListPetsResponseMock = (): Pets => faker.helpers.arrayElement([ { ...getListPetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -87,12 +87,12 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getListPetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -106,8 +106,8 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]), ); @@ -173,7 +173,7 @@ export const getCreatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getCreatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -187,12 +187,12 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getCreatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -206,8 +206,8 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -272,7 +272,7 @@ export const getUpdatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getUpdatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -286,12 +286,12 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getUpdatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -305,8 +305,8 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -371,7 +371,7 @@ export const getShowPetByIdResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getShowPetByIdResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -385,12 +385,12 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getShowPetByIdResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -404,8 +404,8 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); diff --git a/samples/vue-query/custom-fetch/src/gen/pets/pets.msw.ts b/samples/vue-query/custom-fetch/src/gen/pets/pets.msw.ts index 8ba59da21..4a60ca4dc 100644 --- a/samples/vue-query/custom-fetch/src/gen/pets/pets.msw.ts +++ b/samples/vue-query/custom-fetch/src/gen/pets/pets.msw.ts @@ -73,7 +73,7 @@ export const getListPetsResponseMock = (): Pets => faker.helpers.arrayElement([ { ...getListPetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -87,12 +87,12 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getListPetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -106,8 +106,8 @@ export const getListPetsResponseMock = (): Pets => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]), ); @@ -173,7 +173,7 @@ export const getCreatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getCreatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -187,12 +187,12 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getCreatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -206,8 +206,8 @@ export const getCreatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -272,7 +272,7 @@ export const getUpdatePetsResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getUpdatePetsResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -286,12 +286,12 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getUpdatePetsResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -305,8 +305,8 @@ export const getUpdatePetsResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); @@ -371,7 +371,7 @@ export const getShowPetByIdResponseMock = (): Pet => faker.helpers.arrayElement([ { ...getShowPetByIdResponseDogMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -385,12 +385,12 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, { ...getShowPetByIdResponseCatMock(), - '@id': faker.helpers.arrayElement([faker.word.sample(), undefined]), + '@id': faker.helpers.arrayElement([faker.string.alpha(20), undefined]), callingCode: faker.helpers.arrayElement([ faker.helpers.arrayElement(['+33', '+420', '+33'] as const), undefined, @@ -404,8 +404,8 @@ export const getShowPetByIdResponseMock = (): Pet => ]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({ min: undefined, max: undefined }), - name: faker.word.sample(), - tag: faker.helpers.arrayElement([faker.word.sample(), undefined]), + name: faker.string.alpha(20), + tag: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), }, ]); diff --git a/samples/vue-query/vue-query-basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/vue-query/vue-query-basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index b603209d7..f3abf7ed0 100644 --- a/samples/vue-query/vue-query-basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/vue-query/vue-query-basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -222,6 +222,7 @@ export function useListPets< export const createPets = ( createPetsBody: MaybeRef, version: MaybeRef = 1, + signal?: AbortSignal, ) => { createPetsBody = unref(createPetsBody); version = unref(version); @@ -231,6 +232,7 @@ export const createPets = ( method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createPetsBody, + signal, }); }; @@ -458,8 +460,12 @@ export function useShowPetById< /** * @summary This is required to test case when there are no parameters (this path is ignored in add-version transformer), see https://github.com/orval-labs/orval/issues/857#issuecomment-1835317990 */ -export const postApiV1UserLogout = () => { - return customInstance({ url: `/api/v1/user/logout`, method: 'POST' }); +export const postApiV1UserLogout = (signal?: AbortSignal) => { + return customInstance({ + url: `/api/v1/user/logout`, + method: 'POST', + signal, + }); }; export const getPostApiV1UserLogoutMutationOptions = <