You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Currently I can't get type safety when using the generated query key in query client utilities. Describe the solution you'd like
A clear and concise description of what you want to happen.
The query options solves this problem by centralizing the query function and the query key and other custom options in one function.
Generated output now includes a `queries/queryOptions.ts` module built on TanStack Query's `queryOptions()` / `infiniteQueryOptions()` helpers, so the query key and query function are colocated in one type-safe object:
import{useQuery}from"@tanstack/react-query";import{findPetByIdOptions}from"./openapi/queries/queryOptions";const{ data }=useQuery(findPetByIdOptions({path: {id: 1}}));
The same factories work with the query client utilities you mentioned — `queryClient.setQueryData`, `getQueryData`, `ensureQueryData`, etc. — with the key inferred rather than hand-written.
Available now on `latest` (`npm i @7nohe/openapi-react-query-codegen@3`). See the migration guide for the full v3 changes. Thanks for the suggestion and for linking the TkDodo post — it shaped the design.
Activity
feat: generate queryOptions/infiniteQueryOptions factories and dedica…
7nohe commentedon Aug 11, 2026
Implemented in v3.0.0.
Generated output now includes a `queries/queryOptions.ts` module built on TanStack Query's `queryOptions()` / `infiniteQueryOptions()` helpers, so the query key and query function are colocated in one type-safe object:
The same factories work with the query client utilities you mentioned — `queryClient.setQueryData`, `getQueryData`, `ensureQueryData`, etc. — with the key inferred rather than hand-written.
Available now on `latest` (`npm i @7nohe/openapi-react-query-codegen@3`). See the migration guide for the full v3 changes. Thanks for the suggestion and for linking the TkDodo post — it shaped the design.