Package Exports
- @nest-toolbox/open-api-spec-to-ts
- @nest-toolbox/open-api-spec-to-ts/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nest-toolbox/open-api-spec-to-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Open API spec to TS
Generate Typescript interfaces and enums in a specified folder, from you Open API specifications. Depends on json-schema-to-typescript.
Installation
npm i @nest-toolbox/open-api-spec-to-ts
Usage
Inside a module
import { generate } from '@nest-toolbox/open-api-spec-to-ts';
const openApiFilePath = './openapi.json';
const interfacesDirPath = './interfaces';
generate(openApiFilePath, interfacesDirPath);
As a CLI tool
import { generate, LogLevel } from '@nest-toolbox/open-api-spec-to-ts';
import { argv } from 'yargs';
const openApiFilePath = argv.openApiPath || './openapi.json';
const interfacesDirPath = argv.interfacesPath || './interfaces';
const verbosity = argv.verbosity || LogLevel.INFO;
generate(openApiFilePath, interfacesDirPath, { verbosity });
node ./<your-file>.js --openApiPath='./openapi.json' --interfacesPath='./interfaces'"