Type generation tools to generate TypeScript definitions from an OpenAPI specification using openapi-typescript.
Check the autogenerated documentation here.
You can execute the generator programmatically.
import { generateTypes } from '@map-colonies/openapi-generators';
import path from 'node:path';
await generateTypes({
openapiSpecPath: path.resolve(__dirname, './openapi.yaml'),
outputFilePath: path.resolve(__dirname, './generated/types.ts'),
serverInjectPackageName: '@map-colonies/openapi-express-types',
});
The serverInjectPackageName determines which package gets injected for typed handlers (default is @map-colonies/openapi-express-types).