@travetto/openapi 2.0.6 → 2.1.2
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 +6 -6
- package/bin/cli-openapi_client.ts +4 -3
- package/package.json +7 -7
- package/src/config.ts +2 -2
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ export class ApiSpecConfig {
|
|
|
67
67
|
/**
|
|
68
68
|
* Should file be generated at runtime
|
|
69
69
|
*/
|
|
70
|
-
persist: boolean =
|
|
70
|
+
persist: boolean = EnvUtil.isDynamic();
|
|
71
71
|
/**
|
|
72
72
|
* Skip emitting all routes
|
|
73
73
|
*/
|
|
@@ -122,7 +122,7 @@ The module provides a plugin for the [Command Line Interface](https://github.com
|
|
|
122
122
|
```bash
|
|
123
123
|
$ trv openapi:client --help
|
|
124
124
|
|
|
125
|
-
Usage: openapi:client [options] [
|
|
125
|
+
Usage: openapi:client [options] [format-or-preset]
|
|
126
126
|
|
|
127
127
|
Options:
|
|
128
128
|
-x, --extended-help Show Extended Help
|
|
@@ -135,10 +135,10 @@ Options:
|
|
|
135
135
|
|
|
136
136
|
Available Presets
|
|
137
137
|
----------------------------------
|
|
138
|
-
* @trv
|
|
139
|
-
* @trv
|
|
140
|
-
* @trv
|
|
141
|
-
* @trv
|
|
138
|
+
* @trv:angular10 -- typescript-angular supportsES6=true,ngVersion=10.0
|
|
139
|
+
* @trv:angular11 -- typescript-angular supportsES6=true,ngVersion=11.0
|
|
140
|
+
* @trv:angular12 -- typescript-angular supportsES6=true,ngVersion=11.0
|
|
141
|
+
* @trv:fetch -- typescript-fetch
|
|
142
142
|
```
|
|
143
143
|
|
|
144
144
|
This tool relies upon a custom build of [OpenAPI client generation tools](https://github.com/OpenAPITools/openapi-generator), which supports watching. This allows for fast responsive client generation as the shape of the API changes.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import * as fs from 'fs';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
3
4
|
|
|
4
5
|
import { BasePlugin } from '@travetto/cli/src/plugin-base';
|
|
5
6
|
import { AppCache, ExecUtil, PathUtil } from '@travetto/boot';
|
|
6
7
|
import { color } from '@travetto/cli/src/color';
|
|
7
8
|
|
|
8
|
-
const presets = JSON.parse(
|
|
9
|
+
const presets = JSON.parse(readFileSync(PathUtil.resolveUnix(__dirname, '..', 'resources', 'presets.json'), 'utf8')) as Record<string, [string, object] | [string]>;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* CLI for generating the cli client
|
|
@@ -74,7 +75,7 @@ ${this.getListOfFormats().map(x => color`* ${{ input: x }}`).join('\n')} `;
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// Ensure its there
|
|
77
|
-
await fs.
|
|
78
|
+
await fs.mkdir(this.cmd.output, { recursive: true });
|
|
78
79
|
|
|
79
80
|
let propMap = Object.fromEntries(this.cmd.props?.map(p => p.split('=')) ?? []);
|
|
80
81
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/openapi",
|
|
3
3
|
"displayName": "OpenAPI Specification",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.2",
|
|
5
5
|
"description": "OpenAPI integration support for the travetto framework",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rest",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"directory": "module/openapi"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/config": "^2.
|
|
32
|
-
"@travetto/rest": "^2.
|
|
33
|
-
"@travetto/schema": "^2.
|
|
34
|
-
"@travetto/yaml": "^2.
|
|
35
|
-
"openapi3-ts": "^2.0.
|
|
31
|
+
"@travetto/config": "^2.1.2",
|
|
32
|
+
"@travetto/rest": "^2.1.2",
|
|
33
|
+
"@travetto/schema": "^2.1.2",
|
|
34
|
+
"@travetto/yaml": "^2.1.3",
|
|
35
|
+
"openapi3-ts": "^2.0.2"
|
|
36
36
|
},
|
|
37
37
|
"optionalPeerDependencies": {
|
|
38
|
-
"@travetto/cli": "^2.
|
|
38
|
+
"@travetto/cli": "^2.1.2"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
package/src/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import * as fs from 'fs';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
3
|
import { ServerObject, ContactObject, LicenseObject } from 'openapi3-ts/src/model/OpenApi';
|
|
4
4
|
|
|
5
5
|
import { Config } from '@travetto/config';
|
|
@@ -65,7 +65,7 @@ export class ApiSpecConfig {
|
|
|
65
65
|
if (!/[.](json|ya?ml)$/.test(this.output)) { // Assume a folder
|
|
66
66
|
this.output = PathUtil.resolveUnix(this.output, 'openapi.yml');
|
|
67
67
|
}
|
|
68
|
-
await fs.
|
|
68
|
+
await fs.mkdir(path.dirname(this.output), { recursive: true });
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|