@travetto/openapi 2.1.0 → 2.1.3
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/bin/cli-openapi_client.ts +4 -3
- package/package.json +7 -7
- package/src/config.ts +2 -2
|
@@ -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.1.
|
|
4
|
+
"version": "2.1.3",
|
|
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.1.
|
|
32
|
-
"@travetto/rest": "^2.1.
|
|
33
|
-
"@travetto/schema": "^2.1.
|
|
34
|
-
"@travetto/yaml": "^2.1.
|
|
35
|
-
"openapi3-ts": "^2.0.
|
|
31
|
+
"@travetto/config": "^2.1.3",
|
|
32
|
+
"@travetto/rest": "^2.1.3",
|
|
33
|
+
"@travetto/schema": "^2.1.3",
|
|
34
|
+
"@travetto/yaml": "^2.1.3",
|
|
35
|
+
"openapi3-ts": "^2.0.2"
|
|
36
36
|
},
|
|
37
37
|
"optionalPeerDependencies": {
|
|
38
|
-
"@travetto/cli": "^2.1.
|
|
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
|
}
|