1
1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
3
3
exports[`calling without \`outputFile\` returns the generated api 1`] = `
4
- import { api } from "./fixtures/emptyApi";
4
+ " import { api } from "./fixtures/emptyApi";
5
5
const injectedRtkApi = api.injectEndpoints({
6
6
endpoints: (build) => ({
7
7
getHealthcheck: build.query<
@@ -283,11 +283,11 @@ export type User = {
283
283
phone?: string | undefined;
284
284
userStatus?: number | undefined;
285
285
};
286
-
286
+ "
287
287
`;
288
288
289
289
exports[`duplicate parameter names must be prefixed with a path or query prefix 1`] = `
290
- import { api } from "./fixtures/emptyApi";
290
+ " import { api } from "./fixtures/emptyApi";
291
291
const injectedRtkApi = api.injectEndpoints({
292
292
endpoints: (build) => ({
293
293
patchApiV1ListByItemId: build.mutation<
@@ -324,11 +324,11 @@ export type PatchApiV2BySomeNameApiArg = {
324
324
pathSomeName: string;
325
325
querySomeName: string;
326
326
};
327
-
327
+ "
328
328
`;
329
329
330
330
exports[`endpoint filtering > should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder 1`] = `
331
- import { api } from "./fixtures/emptyApi";
331
+ " import { api } from "./fixtures/emptyApi";
332
332
const injectedRtkApi = api.injectEndpoints({
333
333
endpoints: (build) => ({
334
334
placeOrder: build.mutation<PlaceOrderApiResponse, PlaceOrderApiArg>({
@@ -389,11 +389,11 @@ export type Order = {
389
389
status?: ("placed" | "approved" | "delivered") | undefined;
390
390
complete?: boolean | undefined;
391
391
};
392
-
392
+ "
393
393
`;
394
394
395
395
exports[`endpoint overrides > loginUser should be a mutation 1`] = `
396
- import { api } from "./fixtures/emptyApi";
396
+ " import { api } from "./fixtures/emptyApi";
397
397
const injectedRtkApi = api.injectEndpoints({
398
398
endpoints: (build) => ({
399
399
loginUser: build.mutation<LoginUserApiResponse, LoginUserApiArg>({
@@ -415,11 +415,11 @@ export type LoginUserApiArg = {
415
415
/** The password for login in clear text */
416
416
password?: string;
417
417
};
418
-
418
+ "
419
419
`;
420
420
421
421
exports[`falls back to the \`title\` parameter for the body parameter name when no other name is available 1`] = `
422
- import { api } from "fixtures/emptyApi";
422
+ " import { api } from "fixtures/emptyApi";
423
423
const injectedRtkApi = api.injectEndpoints({
424
424
endpoints: (build) => ({
425
425
postV1Export: build.mutation<PostV1ExportApiResponse, PostV1ExportApiArg>({
@@ -449,11 +449,11 @@ export type PostV1ImportApiArg = {
449
449
rawData: string;
450
450
};
451
451
export type IdList = number[];
452
-
452
+ "
453
453
`;
454
454
455
455
exports[`hooks generation > should generate an \`useGetPetByIdQuery\` query hook and an \`useAddPetMutation\` mutation hook 1`] = `
456
- import { api } from "./fixtures/emptyApi";
456
+ " import { api } from "./fixtures/emptyApi";
457
457
const injectedRtkApi = api.injectEndpoints({
458
458
endpoints: (build) => ({
459
459
addPet: build.mutation<AddPetApiResponse, AddPetApiArg>({
@@ -497,11 +497,11 @@ export type Pet = {
497
497
status?: ("available" | "pending" | "sold") | undefined;
498
498
};
499
499
export const { useAddPetMutation, useGetPetByIdQuery } = injectedRtkApi;
500
-
500
+ "
501
501
`;
502
502
503
503
exports[`hooks generation uses overrides > should generate an \`useLoginMutation\` mutation hook 1`] = `
504
- import { api } from "./fixtures/emptyApi";
504
+ " import { api } from "./fixtures/emptyApi";
505
505
const injectedRtkApi = api.injectEndpoints({
506
506
endpoints: (build) => ({
507
507
loginUser: build.mutation<LoginUserApiResponse, LoginUserApiArg>({
@@ -524,11 +524,11 @@ export type LoginUserApiArg = {
524
524
password?: string;
525
525
};
526
526
export const { useLoginUserMutation } = injectedRtkApi;
527
-
527
+ "
528
528
`;
529
529
530
530
exports[`openapi spec > readOnly / writeOnly are merged 1`] = `
531
- import { api } from "./fixtures/emptyApi";
531
+ " import { api } from "./fixtures/emptyApi";
532
532
const injectedRtkApi = api.injectEndpoints({
533
533
endpoints: (build) => ({
534
534
getExample: build.query<GetExampleApiResponse, GetExampleApiArg>({
@@ -556,11 +556,11 @@ export type ExampleSchema = {
556
556
read_only_prop: string;
557
557
write_only_prop: string;
558
558
};
559
-
559
+ "
560
560
`;
561
561
562
562
exports[`openapi spec > readOnly / writeOnly are respected 1`] = `
563
- import { api } from "./fixtures/emptyApi";
563
+ " import { api } from "./fixtures/emptyApi";
564
564
const injectedRtkApi = api.injectEndpoints({
565
565
endpoints: (build) => ({
566
566
getExample: build.query<GetExampleApiResponse, GetExampleApiArg>({
@@ -594,11 +594,11 @@ export type ExampleSchemaWrite = {
594
594
always_present: string;
595
595
write_only_prop: string;
596
596
};
597
-
597
+ "
598
598
`;
599
599
600
600
exports[`should use brackets in a querystring urls arg, when the arg contains full stops 1`] = `
601
- import { api } from "./fixtures/emptyApi";
601
+ " import { api } from "./fixtures/emptyApi";
602
602
const injectedRtkApi = api.injectEndpoints({
603
603
endpoints: (build) => ({
604
604
patchApiV1ListByItemId: build.mutation<
@@ -635,11 +635,11 @@ export type PatchApiV2BySomeNameApiArg = {
635
635
pathSomeName: string;
636
636
querySomeName: string;
637
637
};
638
-
638
+ "
639
639
`;
640
640
641
641
exports[`supports granular hooks generation that includes all query types 1`] = `
642
- import { api } from "./fixtures/emptyApi";
642
+ " import { api } from "./fixtures/emptyApi";
643
643
const injectedRtkApi = api.injectEndpoints({
644
644
endpoints: (build) => ({
645
645
addPet: build.mutation<AddPetApiResponse, AddPetApiArg>({
@@ -684,11 +684,11 @@ export type Pet = {
684
684
};
685
685
export const { useAddPetMutation, useGetPetByIdQuery, useLazyGetPetByIdQuery } =
686
686
injectedRtkApi;
687
-
687
+ "
688
688
`;
689
689
690
690
exports[`supports granular hooks generation with only lazy queries 1`] = `
691
- import { api } from "./fixtures/emptyApi";
691
+ " import { api } from "./fixtures/emptyApi";
692
692
const injectedRtkApi = api.injectEndpoints({
693
693
endpoints: (build) => ({
694
694
addPet: build.mutation<AddPetApiResponse, AddPetApiArg>({
@@ -732,11 +732,11 @@ export type Pet = {
732
732
status?: "available" | "pending" | "sold";
733
733
};
734
734
export const { useLazyGetPetByIdQuery } = injectedRtkApi;
735
-
735
+ "
736
736
`;
737
737
738
738
exports[`supports granular hooks generation with only mutations 1`] = `
739
- import { api } from "./fixtures/emptyApi";
739
+ " import { api } from "./fixtures/emptyApi";
740
740
const injectedRtkApi = api.injectEndpoints({
741
741
endpoints: (build) => ({
742
742
addPet: build.mutation<AddPetApiResponse, AddPetApiArg>({
@@ -780,11 +780,11 @@ export type Pet = {
780
780
status?: "available" | "pending" | "sold";
781
781
};
782
782
export const { useAddPetMutation } = injectedRtkApi;
783
-
783
+ "
784
784
`;
785
785
786
786
exports[`supports granular hooks generation with only queries 1`] = `
787
- import { api } from "./fixtures/emptyApi";
787
+ " import { api } from "./fixtures/emptyApi";
788
788
const injectedRtkApi = api.injectEndpoints({
789
789
endpoints: (build) => ({
790
790
addPet: build.mutation<AddPetApiResponse, AddPetApiArg>({
@@ -828,11 +828,11 @@ export type Pet = {
828
828
status?: "available" | "pending" | "sold";
829
829
};
830
830
export const { useGetPetByIdQuery } = injectedRtkApi;
831
-
831
+ "
832
832
`;
833
833
834
834
exports[`tests from issues > issue #2002: should be able to generate proper intersection types 1`] = `
835
- import { api } from "./tmp/emptyApi";
835
+ " import { api } from "./tmp/emptyApi";
836
836
const injectedRtkApi = api.injectEndpoints({
837
837
endpoints: (build) => ({
838
838
getApiV1Animals: build.query<
@@ -872,11 +872,11 @@ export type Cat = {
872
872
catUniqueProp?: string | null;
873
873
};
874
874
export const { useGetApiV1AnimalsQuery } = injectedRtkApi;
875
-
875
+ "
876
876
`;
877
877
878
878
exports[`yaml parsing > should be able to use read a yaml file 1`] = `
879
- import { api } from "./tmp/emptyApi";
879
+ " import { api } from "./tmp/emptyApi";
880
880
export const addTagTypes = ["pet", "store", "user"] as const;
881
881
const injectedRtkApi = api
882
882
.enhanceEndpoints({
@@ -1199,11 +1199,11 @@ export const {
1199
1199
useUpdateUserMutation,
1200
1200
useDeleteUserMutation,
1201
1201
} = injectedRtkApi;
1202
-
1202
+ "
1203
1203
`;
1204
1204
1205
1205
exports[`yaml parsing > should generate params with non quoted keys if they don't contain special characters 1`] = `
1206
- import { api } from "./tmp/emptyApi";
1206
+ " import { api } from "./tmp/emptyApi";
1207
1207
export const addTagTypes = ["StructureDefinition"] as const;
1208
1208
const injectedRtkApi = api
1209
1209
.enhanceEndpoints({
@@ -1256,11 +1256,11 @@ export type GetStructureDefinitionApiArg = {
1256
1256
};
1257
1257
export type FhirJsonResource = object;
1258
1258
export const { useGetStructureDefinitionQuery } = injectedRtkApi;
1259
-
1259
+ "
1260
1260
`;
1261
1261
1262
1262
exports[`yaml parsing > should parse a yaml schema from a URL 1`] = `
1263
- import { api } from "./tmp/emptyApi";
1263
+ " import { api } from "./tmp/emptyApi";
1264
1264
export const addTagTypes = ["pet", "store", "user"] as const;
1265
1265
const injectedRtkApi = api
1266
1266
.enhanceEndpoints({
@@ -1583,5 +1583,5 @@ export const {
1583
1583
useUpdateUserMutation,
1584
1584
useDeleteUserMutation,
1585
1585
} = injectedRtkApi;
1586
-
1586
+ "
1587
1587
`;
0 commit comments