UNPKG

fastify-openapi-connector-generator

Version:

Complimentary CLI tool for fastify-openapi-connector package. It generates prefabricates for handlers from OpenAPI specification.

50 lines (42 loc) 1.49 kB
# Fastify OpenAPI Connector Generator Companion package to `fastify-openapi-connector` usable both programatically and with `npx`. `fastify-openapi-connector` is minimum dependency package, therefore generator has been split into it's own (this) package. ## Usage Use npx: `npx fastify-openapi-generator <options>` Or import the generator usual way and programatically, everything is exported so you can also just pick bits and pieces. ### Options #### Required * --schema-file * Path to schema file generated by openapi-typescript. * --types-file * Path to where types file should be generated. * --service-file * Path to where service file should be generated. * --spec-file * Path to OpenAPI spec file #### Optional * --help * Display this * --paths-dir * Directory to generate route handlers from paths section of OAS. * --webhooks-dir * Directory to generate route handlers from webhooks section of OAS. * --security-dir * Directory to generate security handlers. * --untyped * Indicates that generated handlers should be untyped. * --override-types-file * Indicates that types file should be overrided if exists. ### Example ```bash npx fastify-openapi-connector-generator \ --schema-file=./src/generated/schema.ts \ --types-file=./src/generated/types.ts \ --service-file=./src/generated/service.ts \ --paths-dir=./src/paths \ --webhooks-dir=./src/webhooks \ --security-dir=./src/security \ --spec-file=./spec.yaml \ --override-types-file ```