Skip to Content
DocumentationPackages@formkit-gov/openapi

@formkit-gov/openapi

Generate Zod schemas and TypeScript types from OpenAPI specifications for schema federation.

Status

Coming in v0.5.0 - This package is currently in development.

See the roadmap  for release timeline.

Overview

The openapi package enables schema federation by generating Zod schemas from your backend’s OpenAPI specification, ensuring frontend validation matches backend requirements.

Planned Features

FeatureDescription
OpenAPI 3.0/3.1 parserFull specification support
Zod schema generatorGenerate type-safe schemas
TypeScript typesGenerate TypeScript interfaces
CLI toolCommand-line interface
Watch modeAuto-regenerate on spec changes
Reference resolutionHandle $ref references
Circular referencesProper handling of circular schemas

Planned CLI Usage

# Generate Zod schemas from OpenAPI spec npx formkit-openapi generate ./openapi.yaml -o ./src/schemas # Watch mode for development npx formkit-openapi generate ./openapi.yaml -o ./src/schemas --watch # Validate OpenAPI specification npx formkit-openapi validate ./openapi.yaml

Planned API Usage

import { generateSchemas } from '@formkit-gov/openapi'; const schemas = await generateSchemas('./openapi.yaml', { output: './src/schemas', format: 'esm', });

Installation

npm install @formkit-gov/openapi
Last updated on