Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.18 KB

File metadata and controls

34 lines (23 loc) · 1.18 KB

CLI reference

npx @fgrzl/fetch-gen --input <openapi.yaml> --output <path.ts> [options]

Required flags

Flag Description
--input Path to OpenAPI 3 YAML or JSON
--output TypeScript file to write

Optional flags

Flag Description
--instance Import path to a custom fetch client module (default: @fgrzl/fetch)

Output

  • TypeScript types for schemas referenced by operations
  • Functions named from OpenAPI operationId — operations without operationId are skipped (logged), not auto-renamed
  • createAdapter(client) export

Regeneration

Overwrite the output file on each run. Do not hand-edit generated files — adjust the OpenAPI spec or generator version instead.

Troubleshooting

  • Ensure operationId is set for stable function names
  • Resolve schema $ref issues in the OpenAPI document before codegen
  • Match @fgrzl/fetch major version with what fetch-gen expects (see fetch release notes)