@travetto/openapi 8.0.0-alpha.16 → 8.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -11
- package/package.json +7 -7
- package/support/cli.openapi_client.ts +9 -6
- package/support/cli.openapi_spec.ts +4 -1
package/README.md
CHANGED
|
@@ -117,39 +117,47 @@ export class ApiSpecConfig {
|
|
|
117
117
|
The framework, when in watch mode, will generate the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification in either [JSON](https://www.json.org) or [YAML](https://en.wikipedia.org/wiki/YAML). This module integrates with the file watching paradigm and can regenerate the openapi spec as changes to endpoints and models are made during development. The output format is defined by the suffix of the output file, `.yaml` or `.json`.
|
|
118
118
|
|
|
119
119
|
## CLI - openapi:spec
|
|
120
|
-
The
|
|
120
|
+
The command will load your application, in non-listening mode, to collect all the endpoints and model information, to produce the `openapi.yml`. Once produced, the code will store the output in the specified location.
|
|
121
121
|
|
|
122
|
-
**Terminal:
|
|
122
|
+
**Terminal: Help for openapi:spec**
|
|
123
123
|
```bash
|
|
124
124
|
$ trv openapi:spec --help
|
|
125
125
|
|
|
126
126
|
Usage: openapi:spec [options]
|
|
127
127
|
|
|
128
|
+
Generate the OpenAPI specification for the selected module.
|
|
129
|
+
|
|
130
|
+
The resulting JSON can be written to stdout or to a file path for use in
|
|
131
|
+
downstream tooling, CI publishing, and client generation pipelines.
|
|
132
|
+
|
|
128
133
|
Options:
|
|
129
134
|
-o, --output <string> Output files
|
|
130
135
|
-m, --module <module> Module to run for
|
|
131
136
|
--help display help for command
|
|
132
137
|
```
|
|
133
138
|
|
|
134
|
-
The command will run your application, in non-server mode, to collect all the endpoints and model information, to produce the `openapi.yml`. Once produced, the code will store the output in the specified location.
|
|
135
|
-
|
|
136
139
|
**Note**: The module supports generating the OpenAPI spec in real-time while listening for changes to endpoints and models.
|
|
137
140
|
|
|
138
141
|
## CLI - openapi:client
|
|
139
|
-
|
|
142
|
+
Generate API clients from an OpenAPI specification using the generator image.
|
|
140
143
|
|
|
141
|
-
**Terminal:
|
|
144
|
+
**Terminal: Help for openapi:client**
|
|
142
145
|
```bash
|
|
143
146
|
$ trv openapi:client --help
|
|
144
147
|
|
|
145
148
|
Usage: openapi:client [options] <format:string>
|
|
146
149
|
|
|
150
|
+
Generate API clients from an OpenAPI specification using the generator image.
|
|
151
|
+
|
|
152
|
+
This command wraps OpenAPI Generator in Docker and writes generated client code
|
|
153
|
+
into the configured output folder.
|
|
154
|
+
|
|
147
155
|
Options:
|
|
148
|
-
-x, --extended-help Show
|
|
149
|
-
-a, --additional-properties <string> Additional
|
|
150
|
-
-i, --input <string> Input
|
|
151
|
-
-o, --output <string> Output
|
|
152
|
-
-d, --docker-image <string> Docker
|
|
156
|
+
-x, --extended-help Show expanded generator help for all available formats/options. (default: false)
|
|
157
|
+
-a, --additional-properties <string> Additional generator properties passed as comma-separated key/value pairs. (default: [])
|
|
158
|
+
-i, --input <string> Input OpenAPI document path. (default: "./openapi.yml")
|
|
159
|
+
-o, --output <string> Output directory for generated client sources. (default: "./api-client")
|
|
160
|
+
-d, --docker-image <string> Docker image used to run OpenAPI Generator. (default: "openapitools/openapi-generator-cli:latest")
|
|
153
161
|
--help display help for command
|
|
154
162
|
```
|
|
155
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/openapi",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenAPI integration support for the Travetto framework",
|
|
6
6
|
"keywords": [
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"directory": "module/openapi"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/schema": "^8.0.0-alpha.
|
|
32
|
-
"@travetto/web": "^8.0.0-alpha.
|
|
33
|
-
"openapi3-ts": "^4.
|
|
34
|
-
"yaml": "^2.
|
|
30
|
+
"@travetto/config": "^8.0.0-alpha.18",
|
|
31
|
+
"@travetto/schema": "^8.0.0-alpha.18",
|
|
32
|
+
"@travetto/web": "^8.0.0-alpha.19",
|
|
33
|
+
"openapi3-ts": "^4.6.0",
|
|
34
|
+
"yaml": "^2.9.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
37
|
+
"@travetto/cli": "^8.0.0-alpha.23"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
|
@@ -7,21 +7,24 @@ import { ExecUtil } from '@travetto/runtime';
|
|
|
7
7
|
import { OpenApiClientHelp } from './bin/help.ts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Generate API clients from an OpenAPI specification using the generator image.
|
|
11
|
+
*
|
|
12
|
+
* This command wraps OpenAPI Generator in Docker and writes generated client code
|
|
13
|
+
* into the configured output folder.
|
|
11
14
|
*/
|
|
12
15
|
@CliCommand()
|
|
13
16
|
export class OpenApiClientCommand implements CliCommandShape {
|
|
14
|
-
/** Show
|
|
17
|
+
/** Show expanded generator help for all available formats/options. */
|
|
15
18
|
@CliFlag({ short: '-x' })
|
|
16
19
|
extendedHelp: boolean = false;
|
|
17
|
-
/** Additional
|
|
20
|
+
/** Additional generator properties passed as comma-separated key/value pairs. */
|
|
18
21
|
@CliFlag({ short: '-a', full: '--additional-properties' })
|
|
19
22
|
properties: string[] = [];
|
|
20
|
-
/** Input
|
|
23
|
+
/** Input OpenAPI document path. */
|
|
21
24
|
input = './openapi.yml';
|
|
22
|
-
/** Output
|
|
25
|
+
/** Output directory for generated client sources. */
|
|
23
26
|
output = './api-client';
|
|
24
|
-
/** Docker
|
|
27
|
+
/** Docker image used to run OpenAPI Generator. */
|
|
25
28
|
dockerImage = 'openapitools/openapi-generator-cli:latest';
|
|
26
29
|
|
|
27
30
|
async help(): Promise<string[]> {
|
|
@@ -7,7 +7,10 @@ import { Registry } from '@travetto/registry';
|
|
|
7
7
|
import { DependencyRegistryIndex } from '@travetto/di';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Generate the OpenAPI specification for the selected module.
|
|
11
|
+
*
|
|
12
|
+
* The resulting JSON can be written to stdout or to a file path for use in
|
|
13
|
+
* downstream tooling, CI publishing, and client generation pipelines.
|
|
11
14
|
*/
|
|
12
15
|
@CliCommand()
|
|
13
16
|
export class OpenApiSpecCommand implements CliCommandShape {
|