Skip to main content
Home

Built and signed on GitHub Actions

Companion package for https://jsr.io/@klexik/fastify-oas-connector to generate types, routes, security handlers and service file

This package works with Node.jsIt is unknown whether this package works with Deno
This package works with Node.js
It is unknown whether this package works with Deno
JSR Score
100%
Published
a year ago (1.1.2)

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

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
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@klexik/fastify-oas-generator

Import symbol

import * as fastify_oas_generator from "@klexik/fastify-oas-generator";
or

Import directly with a jsr specifier

import * as fastify_oas_generator from "jsr:@klexik/fastify-oas-generator";

Add Package

pnpm i jsr:@klexik/fastify-oas-generator
or (using pnpm 10.8 or older)
pnpm dlx jsr add @klexik/fastify-oas-generator

Import symbol

import * as fastify_oas_generator from "@klexik/fastify-oas-generator";

Add Package

yarn add jsr:@klexik/fastify-oas-generator
or (using Yarn 4.8 or older)
yarn dlx jsr add @klexik/fastify-oas-generator

Import symbol

import * as fastify_oas_generator from "@klexik/fastify-oas-generator";

Add Package

vlt install jsr:@klexik/fastify-oas-generator

Import symbol

import * as fastify_oas_generator from "@klexik/fastify-oas-generator";

Add Package

npx jsr add @klexik/fastify-oas-generator

Import symbol

import * as fastify_oas_generator from "@klexik/fastify-oas-generator";