|
1 |
| -# @openapitools/openapi-generator-cli |
2 |
| - |
3 |
| -[](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) |
4 |
| - |
5 |
| -[](https://renovateapp.com/) |
6 |
| -[](https://travis-ci.org/OpenAPITools/openapi-generator-cli) |
7 |
| -[](http://hits.dwyl.com/openapitools/openapi-generator-cli) |
8 |
| - |
9 |
| -OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and |
10 |
| -configuration automatically given an OpenAPI Spec (both 2.0 and 3.0 are supported). Please see |
11 |
| -[OpenAPITools/openapi-generator](https://github.com/OpenAPITools/openapi-generator) |
12 |
| - |
13 |
| ---- |
14 |
| - |
15 |
| -This project checks the [maven repository](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli) |
16 |
| -once a day for a new version and will publish this new version automatically as an npm package. |
17 |
| - |
18 |
| -**Thanks [openapitools.org](https://openapitools.org) for this awesome CLI!** |
19 |
| - |
20 |
| -## Installation |
21 |
| - |
22 |
| -There are several ways to install the package. |
23 |
| - |
24 |
| -#### Global Mode |
25 |
| - |
26 |
| -In global mode (ie, with -g or --global appended to the command), it installs the package as a global package. This |
27 |
| -means that you'll get the `openapi-generator` command available on your command line interface (CLI) as well. |
28 |
| - |
29 |
| -```sh |
30 |
| -# install the latest version of "openapi-generator-cli" |
31 |
| -npm install @openapitools/openapi-generator-cli -g |
32 |
| - |
33 |
| -# install a specific version of "openapi-generator-cli" |
34 |
| -npm install @openapitools/ [email protected] -g |
35 |
| -``` |
36 |
| - |
37 |
| -After the installation has finished you can type for example: |
38 |
| - |
39 |
| -```sh |
40 |
| -# this shall print the correct version number |
41 |
| -openapi-generator version |
42 |
| -``` |
43 |
| - |
44 |
| -#### Package Mode |
45 |
| - |
46 |
| -It is recommended to install the package as development dependency, because normally you only need this dependency |
47 |
| -during the development process. To do that you can type the following: |
48 |
| - |
49 |
| -```sh |
50 |
| -# install the latest version of "openapi-generator-cli" |
51 |
| -npm install @openapitools/openapi-generator-cli -D |
52 |
| - |
53 |
| -# install a specific version of "openapi-generator-cli" |
54 |
| -npm install @openapitools/ [email protected] -D |
55 |
| -``` |
56 |
| - |
57 |
| -After the installation has finished you can add a script like this: |
58 |
| - |
59 |
| -```json |
60 |
| -// package.json |
61 |
| -{ |
62 |
| - "name": "my-cool-package", |
63 |
| - "version": "0.0.0", |
64 |
| - "scripts": { |
65 |
| - "my-awesome-script-name": "openapi-generator generate -i docs/openapi.yaml -g typescript-angular -o generated-sources/openapi --additional-properties=ngVersion=6.1.7,npmName=restClient,supportsES6=true,npmVersion=6.9.0,withInterfaces=true", |
66 |
| - } |
67 |
| -} |
68 |
| -``` |
69 |
| -Note the whitespace sensitivity when using mulitiple additional-properties. |
70 |
| - |
71 |
| -#### Configuration File |
72 |
| - |
73 |
| -It is also possible to store configurations for code generation in the package.json: |
74 |
| - |
75 |
| -```json |
76 |
| -// package.json |
77 |
| -{ |
78 |
| - "name": "my-cool-package", |
79 |
| - "version": "0.0.0", |
80 |
| - "scripts": { |
81 |
| - "my-awesome-script-name": "openapi-generator" |
82 |
| - }, |
83 |
| - "openapi-generator": { |
84 |
| - "docs/*.yaml": [ |
85 |
| - { |
86 |
| - "generator-name": "typescript-angular", |
87 |
| - "output": "#{root}/generated-sources/openapi/typescript-angular/#{name}", |
88 |
| - "additional-properties": { |
89 |
| - "fileNaming": "kebab-case", |
90 |
| - "apiModulePrefix": "#{Name}", |
91 |
| - "npmName": "#{name}RestClient", |
92 |
| - "supportsES6": true, |
93 |
| - "withInterfaces": true |
94 |
| - } |
95 |
| - }, |
96 |
| - { |
97 |
| - "generator-name": "typescript-fetch", |
98 |
| - "output": "#{root}/generated-sources/openapi/typescript-fetch/#{name}" |
99 |
| - } |
100 |
| - ] |
101 |
| - } |
102 |
| -} |
103 |
| -``` |
104 |
| - |
105 |
| -If you don't want to do the configuration in the package.json, you can put it into a separate file: |
106 |
| - |
107 |
| -```json |
108 |
| -// package.json |
109 |
| -{ |
110 |
| - "name": "my-cool-package", |
111 |
| - "version": "0.0.0", |
112 |
| - "scripts": { |
113 |
| - "my-awesome-script-name": "openapi-generator openapi-generator.json" |
114 |
| - } |
115 |
| -} |
116 |
| - |
117 |
| -// openapi-generator.json |
118 |
| -{ |
119 |
| - "docs/*.yaml": [ |
120 |
| - { |
121 |
| - "generator-name": "typescript-angular", |
122 |
| - "output": "#{root}/generated-sources/openapi/typescript-angular/#{name}", |
123 |
| - "additional-properties": { |
124 |
| - "fileNaming": "kebab-case", |
125 |
| - "apiModulePrefix": "#{Name}", |
126 |
| - "npmName": "#{name}RestClient", |
127 |
| - "supportsES6": true, |
128 |
| - "withInterfaces": true |
129 |
| - } |
130 |
| - }, |
131 |
| - { |
132 |
| - "generator-name": "typescript-fetch", |
133 |
| - "output": "#{root}/generated-sources/openapi/typescript-fetch/#{name}" |
134 |
| - } |
135 |
| - ] |
136 |
| -} |
137 |
| -``` |
138 |
| - |
139 |
| -##### Executing Command Placeholders |
140 |
| - |
141 |
| -| placeholder | description | example | |
142 |
| -|--------------|---------------------------------------------------------------|-------------------------------------------------------| |
143 |
| -| name | just file name | auth | |
144 |
| -| Name | just file name, but starting with a capital letter | Auth | |
145 |
| -| root | file root | /Users/some-user/projects/some-project | |
146 |
| -| base | file name and extension | auth.yaml | |
147 |
| -| path | full path and filename | /Users/some-user/projects/some-project/docs/auth.yaml | |
148 |
| -| dir | path without the filename | /Users/some-user/projects/some-project/docs | |
149 |
| -| reldir | directory name of file relative to the glob provided | docs | |
150 |
| -| relpath | file name and extension of file relative to the glob provided | docs/auth.yaml | |
151 |
| -| ext | just file extension | yaml | |
152 |
| - |
153 |
| -## Usage Example |
154 |
| - |
155 |
| -Mac/Linux: |
156 |
| -``` |
157 |
| -openapi-generator generate -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /var/tmp/ruby-client |
158 |
| -``` |
159 |
| - |
160 |
| -Windows: |
161 |
| -``` |
162 |
| -openapi-generator generate -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o C:\temp\ruby-client |
163 |
| -``` |
164 |
| - |
165 |
| -## Further Documentation |
166 |
| - |
167 |
| -Please refer to the [official openapi-generator docs](https://github.com/OpenAPITools/openapi-generator#3---usage) for |
168 |
| -more information about the possible arguments and a detailed usage manual of the command line interface. |
169 |
| - |
170 |
| -## You like the package? |
171 |
| - |
172 |
| -Please leave a star. |
| 1 | +# Openapitools |
| 2 | + |
| 3 | +This project was generated using [Nx](https://nx.dev). |
| 4 | + |
| 5 | +<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p> |
| 6 | + |
| 7 | +🔎 **Nx is a set of Extensible Dev Tools for Monorepos.** |
| 8 | + |
| 9 | +## Adding capabilities to your workspace |
| 10 | + |
| 11 | +Nx supports many plugins which add capabilities for developing different types of applications and different tools. |
| 12 | + |
| 13 | +These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well. |
| 14 | + |
| 15 | +Below are our core plugins: |
| 16 | + |
| 17 | +- [React](https://reactjs.org) |
| 18 | + - `npm install --save-dev @nrwl/react` |
| 19 | +- Web (no framework frontends) |
| 20 | + - `npm install --save-dev @nrwl/web` |
| 21 | +- [Angular](https://angular.io) |
| 22 | + - `npm install --save-dev @nrwl/angular` |
| 23 | +- [Nest](https://nestjs.com) |
| 24 | + - `npm install --save-dev @nrwl/nest` |
| 25 | +- [Express](https://expressjs.com) |
| 26 | + - `npm install --save-dev @nrwl/express` |
| 27 | +- [Node](https://nodejs.org) |
| 28 | + - `npm install --save-dev @nrwl/node` |
| 29 | + |
| 30 | +There are also many [community plugins](https://nx.dev/nx-community) you could add. |
| 31 | + |
| 32 | +## Generate an application |
| 33 | + |
| 34 | +Run `nx g @nrwl/react:app my-app` to generate an application. |
| 35 | + |
| 36 | +> You can use any of the plugins above to generate applications as well. |
| 37 | +
|
| 38 | +When using Nx, you can create multiple applications and libraries in the same workspace. |
| 39 | + |
| 40 | +## Generate a library |
| 41 | + |
| 42 | +Run `nx g @nrwl/react:lib my-lib` to generate a library. |
| 43 | + |
| 44 | +> You can also use any of the plugins above to generate libraries as well. |
| 45 | +
|
| 46 | +Libraries are sharable across libraries and applications. They can be imported from `@openapitools/mylib`. |
| 47 | + |
| 48 | +## Development server |
| 49 | + |
| 50 | +Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. |
| 51 | + |
| 52 | +## Code scaffolding |
| 53 | + |
| 54 | +Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component. |
| 55 | + |
| 56 | +## Build |
| 57 | + |
| 58 | +Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. |
| 59 | + |
| 60 | +## Running unit tests |
| 61 | + |
| 62 | +Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io). |
| 63 | + |
| 64 | +Run `nx affected:test` to execute the unit tests affected by a change. |
| 65 | + |
| 66 | +## Running end-to-end tests |
| 67 | + |
| 68 | +Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io). |
| 69 | + |
| 70 | +Run `nx affected:e2e` to execute the end-to-end tests affected by a change. |
| 71 | + |
| 72 | +## Understand your workspace |
| 73 | + |
| 74 | +Run `nx dep-graph` to see a diagram of the dependencies of your projects. |
| 75 | + |
| 76 | +## Further help |
| 77 | + |
| 78 | +Visit the [Nx Documentation](https://nx.dev) to learn more. |
| 79 | + |
| 80 | +## ☁ Nx Cloud |
| 81 | + |
| 82 | +### Computation Memoization in the Cloud |
| 83 | + |
| 84 | +<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p> |
| 85 | + |
| 86 | +Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly. |
| 87 | + |
| 88 | +Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers. |
| 89 | + |
| 90 | +Visit [Nx Cloud](https://nx.app/) to learn more. |
0 commit comments