Config reference
The config is data: openapi-forge.config.yaml, .yml or .json, or an rc file (.openapi-forgerc, with the same .yaml, .yml and .json variants), searched in the folder you run it from in that order, or any file you pass with --config. A file ending in .json is read as JSON and any other as YAML, which includes the rc file with no extension; JSON is valid YAML, so that file may hold either. All keys are optional. An option the tool does not know, such as a typo, is an error that names the file and lists the valid ones.
input: openapi.json # file | URL | folder of documents | { service: fileOrUrl }out: src/api/generatedapiPrefix: /api/v1 # stripped from every routebaseUrlEnv: VITE_API_URL # the variable axios / fetch / Angular read the base URL from; api-client finds its ownclient: builtin # builtin | customtarget: hooks # hooks | requestslibrary: react-query # vue-query | svelte-query | solid-query | angular-query | swrhttp: api-client # fetch | axios | angular - for the built-in runtimetags: { include: [], exclude: [] }zod: falseinfinite: falseheaders: { Authorization: "Bearer …" } # for a URL inputtls: { insecure: false, ca: internal-ca.pem }format: prettier # or falsesources: { users: "https://host/users/openapi.yaml" } # for `pull`specsDir: openapi-specsdecisionsFile: openapi-forge.decisions.jsongeneratorName: openapi-forge # the banner of every fileverbose: false# runtime: see "Your own transport"# transform: see "Opt-in extras" (functions: only a script config can hold it)A script (openapi-forge.config.mjs, .js or .cjs) is read after all of these. It is the only place transform can go. It default-exports the object, or a function (sync or async) that returns it, and defineConfig only gives your editor the types:
import { defineConfig } from "@mrzr/openapi-forge";
export default defineConfig({ input: "openapi.json", transform: { /* see "Opt-in extras" */ } });