Library that generates Typescript clients based on the OpenAPI specification.
npm install next-openapi-typescript-codegen[![NPM][npm-image]][npm-url]
[![License][license-image]][license-url]
[![Coverage][coverage-image]][coverage-url]
[![Coverage][coverage-image]][coverage-url]
[![Downloads][downloads-image]][downloads-url]
[![Build][build-image]][build-url]
> Node.js library that generates Typescript clients based on the OpenAPI specification.
```
npm install openapi-typescript-codegen --save-dev
`
$ openapi --help
Usage: openapi [options]
Options:
-V, --version output the version number
-i, --input
-o, --output
-c, --client
--name
--useOptions Use options instead of arguments
--useUnionTypes Use union types instead of enums
--exportCore
--exportServices
--exportModels
--exportSchemas
--indent
--postfixServices Service name postfix (default: "Service")
--postfixModels Model name postfix
--request
-h, --help display help for command
Examples
$ openapi --input ./spec.json --output ./generated
$ openapi --input ./spec.json --output ./generated --client xhr
`
To build the Docker container, execute the following command:
``
docker build . --tag openapi-typescript-codegen
After this is done, you can execute the CLI commands:
``
docker run openapi-typescript-codegen --help
docker run openapi-typescript-codegen --input sample.yaml --output client
Documentation
===
- Basic usage
- OpenAPI object
- Client instances --name--useOptions
- Argument vs. Object style --useUnionTypes
- Enums vs. Union types --exportSchemas`
- Runtime schemas
- Enum with custom names and descriptions
- Nullable props (OpenAPI v2)
- Authorization
- External references
- Canceling requests
- Custom request file
Support
===
- Babel support
- Axios support
- Angular support
- Node-Fetch support
[npm-url]: https://npmjs.org/package/openapi-typescript-codegen
[npm-image]: https://img.shields.io/npm/v/openapi-typescript-codegen.svg
[license-url]: LICENSE
[license-image]: http://img.shields.io/npm/l/openapi-typescript-codegen.svg
[coverage-url]: https://codecov.io/gh/ferdikoomen/openapi-typescript-codegen
[coverage-image]: https://img.shields.io/codecov/c/github/ferdikoomen/openapi-typescript-codegen.svg
[downloads-url]: http://npm-stat.com/charts.html?package=openapi-typescript-codegen
[downloads-image]: http://img.shields.io/npm/dm/openapi-typescript-codegen.svg
[build-url]: https://circleci.com/gh/ferdikoomen/openapi-typescript-codegen/tree/master
[build-image]: https://circleci.com/gh/ferdikoomen/openapi-typescript-codegen/tree/master.svg?style=svg