Skip to content

Opt-in extras

Off by default, so the default output stays small.

zod: true # schemas.ts: a Zod validator per model, typed as `z.ZodType<Model>`
infinite: true # use<Op>InfiniteQuery for every paged read with `start` + `offset`
# infinite: { start: page, size: limit } # other paging parameter names

zod needs the zod package. infinite needs useApiInfiniteQuery and ApiInfiniteQueryOptions in a custom runtime (the built-in one writes them). It applies to reads that answer ApiListData (so count and list must be required, see Answers) and take no path id; header parameters are arguments of the hook, as in any other read.

transform changes names and operations for what a document gets wrong. It takes functions, so it is the one option a YAML or JSON file cannot hold: write it in openapi-forge.config.mjs. Only one config file is read, the first found, so a script that holds transform holds all the other options too:

transform: {
queryParam: (name, { service, operation, path }) => name, // a query parameter's name on the wire
operationName: (operation) => undefined, // return a new name to rename
fileName: (tag) => tag, // module file per tag
operation: (operation) => operation, // change one, or return null to drop it
},