|
1 |
| -# OpenAPI Typescript Codegen |
| 1 | +# OpenAPI TypeScript Codegen |
2 | 2 |
|
3 |
| -[![NPM][npm-image]][npm-url] |
4 |
| -[![License][license-image]][license-url] |
5 |
| -[![Coverage][coverage-image]][coverage-url] |
6 |
| -[![Coverage][coverage-image]][coverage-url] |
7 |
| -[![Downloads][downloads-image]][downloads-url] |
8 |
| -[![Build][build-image]][build-url] |
| 3 | +Fork of [ferdikoomen/openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen). See that repository for documentation. |
9 | 4 |
|
10 |
| -> Node.js library that generates Typescript clients based on the OpenAPI specification. |
| 5 | +## List of changes |
11 | 6 |
|
12 |
| -## Why? |
13 |
| -- Frontend ❤️ OpenAPI, but we do not want to use JAVA codegen in our builds |
14 |
| -- Quick, lightweight, robust and framework-agnostic 🚀 |
15 |
| -- Supports generation of TypeScript clients |
16 |
| -- Supports generations of Fetch, Node-Fetch, Axios, Angular and XHR http clients |
17 |
| -- Supports OpenAPI specification v2.0 and v3.0 |
18 |
| -- Supports JSON and YAML files for input |
19 |
| -- Supports generation through CLI, Node.js and NPX |
20 |
| -- Supports tsc and @babel/plugin-transform-typescript |
21 |
| -- Supports aborting of requests (cancelable promise pattern) |
22 |
| -- Supports external references using [json-schema-ref-parser](https://github.com/APIDevTools/json-schema-ref-parser/) |
23 |
| - |
24 |
| -## Install |
25 |
| - |
26 |
| -``` |
27 |
| -npm install openapi-typescript-codegen --save-dev |
28 |
| -``` |
29 |
| - |
30 |
| -## Usage |
31 |
| - |
32 |
| -``` |
33 |
| -$ openapi --help |
34 |
| -
|
35 |
| - Usage: openapi [options] |
36 |
| -
|
37 |
| - Options: |
38 |
| - -V, --version output the version number |
39 |
| - -i, --input <value> OpenAPI specification, can be a path, url or string content (required) |
40 |
| - -o, --output <value> Output directory (required) |
41 |
| - -c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch") |
42 |
| - --name <value> Custom client class name |
43 |
| - --useOptions Use options instead of arguments |
44 |
| - --useUnionTypes Use union types instead of enums |
45 |
| - --exportCore <value> Write core files to disk (default: true) |
46 |
| - --exportServices <value> Write services to disk (default: true) |
47 |
| - --exportModels <value> Write models to disk (default: true) |
48 |
| - --exportSchemas <value> Write schemas to disk (default: false) |
49 |
| - --indent <value> Indentation options [4, 2, tab] (default: "4") |
50 |
| - --postfixServices Service name postfix (default: "Service") |
51 |
| - --postfixModels Model name postfix |
52 |
| - --request <value> Path to custom request file |
53 |
| - -h, --help display help for command |
54 |
| -
|
55 |
| - Examples |
56 |
| - $ openapi --input ./spec.json --output ./generated |
57 |
| - $ openapi --input ./spec.json --output ./generated --client xhr |
58 |
| -``` |
59 |
| - |
60 |
| -## Docker usage |
61 |
| - |
62 |
| -To build the Docker container, execute the following command: |
63 |
| - |
64 |
| -``` |
65 |
| -docker build . --tag openapi-typescript-codegen |
66 |
| -``` |
67 |
| - |
68 |
| -After this is done, you can execute the CLI commands: |
69 |
| - |
70 |
| -``` |
71 |
| -docker run openapi-typescript-codegen --help |
72 |
| -docker run openapi-typescript-codegen --input sample.yaml --output client |
73 |
| -``` |
74 |
| - |
75 |
| -Documentation |
76 |
| -=== |
77 |
| -- [Basic usage](docs/basic-usage.md) |
78 |
| -- [OpenAPI object](docs/openapi-object.md) |
79 |
| -- [Client instances](docs/client-instances.md) `--name` |
80 |
| -- [Argument vs. Object style](docs/arguments-vs-object-style.md) `--useOptions` |
81 |
| -- [Enums vs. Union types](docs/enum-vs-union-types.md) `--useUnionTypes` |
82 |
| -- [Runtime schemas](docs/runtime-schemas.md) `--exportSchemas` |
83 |
| -- [Enum with custom names and descriptions](docs/custom-enums.md) |
84 |
| -- [Nullable props (OpenAPI v2)](docs/nullable-props.md) |
85 |
| -- [Authorization](docs/authorization.md) |
86 |
| -- [External references](docs/external-references.md) |
87 |
| -- [Canceling requests](docs/canceling-requests.md) |
88 |
| -- [Custom request file](docs/custom-request-file.md) |
89 |
| - |
90 |
| -Support |
91 |
| -=== |
92 |
| -- [Babel support](docs/babel-support.md) |
93 |
| -- [Axios support](docs/axios-support.md) |
94 |
| -- [Angular support](docs/angular-support.md) |
95 |
| -- [Node-Fetch support](docs/node-fetch-support.md) |
96 |
| - |
97 |
| -[npm-url]: https://npmjs.org/package/openapi-typescript-codegen |
98 |
| -[npm-image]: https://img.shields.io/npm/v/openapi-typescript-codegen.svg |
99 |
| -[license-url]: LICENSE |
100 |
| -[license-image]: http://img.shields.io/npm/l/openapi-typescript-codegen.svg |
101 |
| -[coverage-url]: https://codecov.io/gh/ferdikoomen/openapi-typescript-codegen |
102 |
| -[coverage-image]: https://img.shields.io/codecov/c/github/ferdikoomen/openapi-typescript-codegen.svg |
103 |
| -[downloads-url]: http://npm-stat.com/charts.html?package=openapi-typescript-codegen |
104 |
| -[downloads-image]: http://img.shields.io/npm/dm/openapi-typescript-codegen.svg |
105 |
| -[build-url]: https://circleci.com/gh/ferdikoomen/openapi-typescript-codegen/tree/master |
106 |
| -[build-image]: https://circleci.com/gh/ferdikoomen/openapi-typescript-codegen/tree/master.svg?style=svg |
| 7 | +1. Headers are always optional, whether the Open API JSON says they are required or not. |
0 commit comments