Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"generate:api": "rimraf ./openapi && node ../../dist/cli.mjs -i ../petstore.yaml -c axios --request ./request.ts --format=biome --lint=biome --nextPageParam=meta.next"
"generate:api": "rimraf ./openapi && node ../../dist/cli.mjs -i ../petstore.yaml -c axios --request ./request.ts --format=biome --lint=biome --operationId --nextPageParam=meta.next"
},
"dependencies": {
"@tanstack/react-query": "^5.32.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev:mock": "prism mock ../petstore.yaml --dynamic",
"build": "tsc && vite build",
"preview": "vite preview",
"generate:api": "rimraf ./openapi && node ../../dist/cli.mjs -i ../petstore.yaml -c axios --request ./request.ts --format=biome --lint=biome --nextPageParam=meta.next",
"generate:api": "rimraf ./openapi && node ../../dist/cli.mjs -i ../petstore.yaml -c axios --request ./request.ts --format=biome --lint=biome --operationId --nextPageParam=meta.next",
"test:generated": "tsc -p ./tsconfig.openapi.json --noEmit"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/generate.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function generate(options: LimitedUserConfig, version: string) {
export: true,
response: formattedOptions.serviceResponse,
asClass: true,
operationId: formattedOptions.operationId ?? false,
},
types: {
dates: formattedOptions.useDateType,
Expand Down
15 changes: 15 additions & 0 deletions tests/__snapshots__/generate.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ export const ensureUseDefaultServiceFindPaginatedPetsData = (queryClient: QueryC
page?: number;
tags?: string[];
} = {}) => queryClient.ensureQueryData({ queryKey: Common.UseDefaultServiceFindPaginatedPetsKeyFn({ limit, page, tags }), queryFn: () => DefaultService.findPaginatedPets({ limit, page, tags }) });
/**
* Returns cursor-based pets from the system that the user has access to
*
* @param data The data for the request.
* @param data.page string to start from
* @param data.tags tags to filter by
* @param data.limit maximum number of results to return
* @returns unknown pet response
* @throws ApiError
*/
export const ensureUseDefaultServiceFindCursorBasedPetsData = (queryClient: QueryClient, { limit, page, tags }: {
limit?: number;
page?: string;
tags?: string[];
} = {}) => queryClient.ensureQueryData({ queryKey: Common.UseDefaultServiceFindCursorBasedPetsKeyFn({ limit, page, tags }), queryFn: () => DefaultService.findCursorBasedPets({ limit, page, tags }) });
"
`;

Expand Down
1 change: 1 addition & 0 deletions tests/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe("generate", () => {
pageParam: "page",
nextPageParam: "meta.next",
initialPageParam: "initial",
operationId: true,
};
await generate(options, "1.0.0");
});
Expand Down
Loading