Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ferdikoomen/openapi-typescript-codegen
NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
https://github.com/ferdikoomen/openapi-typescript-codegen
angular axios codegen generator javascript nodejs openapi swagger typescript
Last synced: about 2 hours ago
JSON representation
NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
- Host: GitHub
- URL: https://github.com/ferdikoomen/openapi-typescript-codegen
- Owner: ferdikoomen
- License: mit
- Created: 2019-11-05T09:22:03.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-13T21:28:18.000Z (7 days ago)
- Last Synced: 2025-01-19T08:35:14.018Z (1 day ago)
- Topics: angular, axios, codegen, generator, javascript, nodejs, openapi, swagger, typescript
- Language: TypeScript
- Homepage:
- Size: 23.5 MB
- Stars: 3,039
- Watchers: 15
- Forks: 531
- Open Issues: 253
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-list - openapi-typescript-codegen
README
# Important announcement
> [!IMPORTANT]
> Please migrate your projects to use [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts)Due to time limitations on my end, this project has been unmaintained for a while now. The `@hey-api/openapi-ts`
project started as a fork with the goal to resolve the most pressing issues. going forward they are planning to
maintain the OpenAPI generator and give it the love it deserves. Please support them with their work and make
sure to migrate your projects: https://heyapi.dev/openapi-ts/migrating.html#openapi-typescript-codegen- All open PR's and issues will be archived on the 1st of May 2024
- All versions of this package will be deprecated in NPM👋 Thanks for all the support, downloads and love! Cheers Ferdi.
---
# OpenAPI Typescript Codegen
[![NPM][npm-image]][npm-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Build][build-image]][build-url]> Node.js library that generates Typescript clients based on the OpenAPI specification.
## Why?
- Frontend ❤️ OpenAPI, but we do not want to use JAVA codegen in our builds
- Quick, lightweight, robust and framework-agnostic 🚀
- Supports generation of TypeScript clients
- Supports generations of Fetch, Node-Fetch, Axios, Angular and XHR http clients
- Supports OpenAPI specification v2.0 and v3.0
- Supports JSON and YAML files for input
- Supports generation through CLI, Node.js and NPX
- Supports tsc and @babel/plugin-transform-typescript
- Supports aborting of requests (cancelable promise pattern)
- Supports external references using [json-schema-ref-parser](https://github.com/APIDevTools/json-schema-ref-parser/)## Install
```
npm install openapi-typescript-codegen --save-dev
```## Usage
```
$ openapi --helpUsage: openapi [options]
Options:
-V, --version output the version number
-i, --input OpenAPI specification, can be a path, url or string content (required)
-o, --output Output directory (required)
-c, --client HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
--name Custom client class name
--useOptions Use options instead of arguments
--useUnionTypes Use union types instead of enums
--exportCore Write core files to disk (default: true)
--exportServices Write services to disk (default: true)
--exportModels Write models to disk (default: true)
--exportSchemas Write schemas to disk (default: false)
--indent Indentation options [4, 2, tab] (default: "4")
--postfixServices Service name postfix (default: "Service")
--postfixModels Model name postfix
--request Path to custom request file
-h, --help display help for commandExamples
$ openapi --input ./spec.json --output ./generated
$ openapi --input ./spec.json --output ./generated --client xhr
```Documentation
===The main documentation can be found in the [openapi-typescript-codegen/wiki](https://github.com/ferdikoomen/openapi-typescript-codegen/wiki)
Sponsors
===If you or your company use the OpenAPI Typescript Codegen, please consider supporting me. By sponsoring I can free up time to give this project some love! Details can be found here: https://github.com/sponsors/ferdikoomen
If you're from an enterprise looking for a fully managed SDK generation, please consider our sponsor:
[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/main
[build-image]: https://circleci.com/gh/ferdikoomen/openapi-typescript-codegen/tree/main.svg?style=svg