Skip to content

Features

Generated code

  • Models — one type per schema: inline objects get names, allOf / oneOf / anyOf, nullable, enums, tuples (prefixItems), records (additionalProperties), Blob for uploads, circular references.
  • Routes — <tag>Endpoints, the one place each URL is written; the request functions read their route from it, so a path changes in a single line.
  • Request functions — one per operation, with typed path, query, header and body arguments, a config argument for signal, baseUrl and the like, and a JSDoc block (summary, description, METHOD /route, @deprecated).
  • Query-key factories — <tag>Keys with all, its two halves lists() and details() (a read with a path id is a detail, any other a list) and one key per read: the half, the operation’s route (read from <tag>Endpoints) and the arguments its answer depends on (["Pets", "detail", "/pets/{pet_id}", "7"]), so invalidating a tag, all its lists or all its details is one line and a path still changes in one place.
  • Hooks for React Query, Vue Query, Svelte Query, Solid Query, Angular Query or SWR: a query hook per read, a mutation hook per write (or only plain request functions with target: "requests").
  • Reactive arguments — in Vue, Svelte, Solid and Angular a hook argument may be a ref, a getter or a signal, and the query follows it.
  • Zod validators (zod: true) — schemas.ts, one validator per model, typed z.ZodType<Model> so the two cannot drift apart.
  • Infinite-list hooks (infinite: true) for paged reads.
  • Shared types — query and variable types with the same shape are written once (aliased, or Omit<…> & { … } when close); an inline object that repeats a named model reuses it.

Transport

  • Four built-in HTTP clients — @mrzr/api-client (default), fetch, axios and Angular’s HttpClient. Each one is called as itself, in its own way — apiClient.get(…), http.get(…) on an axios instance, fetch(…), an injectable Angular service over HttpClient: the answer, the errors and the interceptors are the client’s own, and the generator only gives it the request the document describes.
  • Or your own — client: "custom" imports your transport; every name and module path is configurable.
  • The request the document describes — the route, the query, header parameters, multipart/form-data, application/x-www-form-urlencoded, text and binary bodies, bodies on DELETE, and how a non-JSON answer should be read (text or blob). What a client cannot write is listed, not sent differently in silence.
  • Types that match the client — the type of an answer is what the chosen client returns. @mrzr/api-client is called straight and answers with its own IRes<T>, whose data is the payload (it takes the data of a { data } answer itself, so a { result, data } envelope is typed as its data); axios answers an AxiosResponse<T>, fetch a Response, Angular an Observable<T>. { count, list } becomes ApiListData<T>.
  • Cancellation — queries, mutations and infinite lists pass an AbortSignal to the request (SWR cannot cancel, see below); what an aborted call does is the client’s own.

Input

  • Swagger 2.0, OpenAPI 3.0 and 3.1, as JSON or YAML, from a file, a folder of files or a URL.
  • Request headers for protected URLs; --insecure and --ca for private / self-signed certificates.
  • Several backend services in one layer — merged, with conflicts decided once and committed to openapi-forge.decisions.json; per-service base URLs.
  • An incomplete document never breaks the output: gaps are typed unknown and listed with the operation and the part to fix.

Workflow

  • generate, pull, diff, doctor, init commands; --watch; --check.
  • Change reports — what a new spec breaks, in terms of your code (operation, hook, schema, property): breaking / risky / safe, as text, Markdown or JSON, with --fail-on for CI.
  • Hooks into naming — rename operations, query parameters and files, or drop an operation, with the transform option.
  • Tag filters, an apiPrefix stripped from every route, a custom banner (generatorName).
  • Strict TypeScript, ships its own .d.ts, Node ≥ 20, one runtime dependency (yaml).