🚨 Breaking Changes 🚨
.infiniteOptions
input now accepts a function
.infiniteOptions
input now requires a function, giving you more control over where the cursor is placed and improves compatibility by removing the requirement for your input to match { cursor?: any }
.
const listQuery = useInfiniteQuery(
orpc.planet.list.infiniteOptions({
input: cursor => ({ cursor }),
getNextPageParam: lastPage => (lastPage.at(-1)?.id ?? -1) + 1,
initialPageParam: 0,
}),
)
🌟 .spec
Helper 🌟
The .spec
helper allows you to customize OpenAPI specs based on middlewares and error handling.
Example: Adding security via middleware
import { oo } from '@orpc/openapi'
const authMid = oo.spec(
os.middleware(({ context, path, next }, input) => {
// Authentication logic
return next()
}),
{
security: [{ bearerAuth: [] }],
},
)
Example: Attaching OpenAPI metadata to errors
const base = os.errors({
UNAUTHORIZED: oo.spec({}, {
security: [{ bearerAuth: [] }],
}),
})
Any procedure using authMid
or derived from base
will automatically include the security
field in the OpenAPI spec.
🚨 Breaking Changes
- query: Redesign
pageParam
input to use a function and refine internal types - by @unnoq in #126 (172fe)