@travetto/openapi 4.0.0-rc.0 → 4.0.0-rc.10
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/package.json +8 -8
- package/src/service.ts +2 -2
- package/support/bin/help.ts +7 -6
- package/support/cli.openapi_client.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/openapi",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.10",
|
|
4
4
|
"description": "OpenAPI integration support for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rest",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"directory": "module/openapi"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^4.0.0-rc.
|
|
30
|
-
"@travetto/rest": "^4.0.0-rc.
|
|
31
|
-
"@travetto/schema": "^4.0.0-rc.
|
|
32
|
-
"@travetto/yaml": "^4.0.0-rc.
|
|
33
|
-
"openapi3-ts": "^4.1
|
|
29
|
+
"@travetto/config": "^4.0.0-rc.8",
|
|
30
|
+
"@travetto/rest": "^4.0.0-rc.10",
|
|
31
|
+
"@travetto/schema": "^4.0.0-rc.8",
|
|
32
|
+
"@travetto/yaml": "^4.0.0-rc.8",
|
|
33
|
+
"openapi3-ts": "^4.2.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/cli": "^4.0.0-rc.
|
|
37
|
-
"@travetto/command": "^4.0.0-rc.
|
|
36
|
+
"@travetto/cli": "^4.0.0-rc.8",
|
|
37
|
+
"@travetto/command": "^4.0.0-rc.8"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenAPIObject } from 'openapi3-ts/oas31';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Util } from '@travetto/base';
|
|
4
4
|
import { Injectable, Inject } from '@travetto/di';
|
|
5
5
|
import { ControllerRegistry, ControllerVisitUtil, RestConfig } from '@travetto/rest';
|
|
6
6
|
import { SchemaRegistry } from '@travetto/schema';
|
|
@@ -80,7 +80,7 @@ export class OpenApiService {
|
|
|
80
80
|
JSON.stringify(spec, undefined, 2) :
|
|
81
81
|
YamlUtil.serialize(spec);
|
|
82
82
|
|
|
83
|
-
await
|
|
83
|
+
await Util.bufferedFileWrite(this.apiSpecConfig.output, output);
|
|
84
84
|
} catch (err) {
|
|
85
85
|
console.error('Unable to persist openapi spec', err);
|
|
86
86
|
}
|
package/support/bin/help.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { ExecUtil } from '@travetto/base';
|
|
5
|
+
import { path, RuntimeContext } from '@travetto/manifest';
|
|
4
6
|
import { cliTpl } from '@travetto/cli';
|
|
7
|
+
|
|
5
8
|
import { OpenApiClientPresets } from './presets';
|
|
6
|
-
import { ExecUtil } from '@travetto/base';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Help utility for openapi client command
|
|
@@ -11,11 +13,10 @@ import { ExecUtil } from '@travetto/base';
|
|
|
11
13
|
export class OpenApiClientHelp {
|
|
12
14
|
|
|
13
15
|
static async getListOfFormats(dockerImage: string): Promise<string[]> {
|
|
14
|
-
const formatCache =
|
|
16
|
+
const formatCache = RuntimeContext.toolPath('openapi-formats.json');
|
|
15
17
|
if (!await fs.stat(formatCache).catch(() => false)) {
|
|
16
|
-
const stdout = ExecUtil.spawn('docker', ['run', '--rm', dockerImage, 'list']);
|
|
17
|
-
const
|
|
18
|
-
const lines = res.stdout
|
|
18
|
+
const { stdout } = await ExecUtil.getResult(spawn('docker', ['run', '--rm', dockerImage, 'list'], { shell: false }));
|
|
19
|
+
const lines = stdout
|
|
19
20
|
.split('DOCUMENTATION')[0]
|
|
20
21
|
.trim()
|
|
21
22
|
.split(/\n/g)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { path } from '@travetto/manifest';
|
|
2
2
|
import { CliCommandShape, CliCommand, CliFlag } from '@travetto/cli';
|
|
3
3
|
import { DockerContainer } from '@travetto/command';
|
|
4
|
+
import { ExecUtil } from '@travetto/base';
|
|
4
5
|
|
|
5
6
|
import { OpenApiClientHelp } from './bin/help';
|
|
6
7
|
import { OpenApiClientPresets } from './bin/presets';
|
|
@@ -62,7 +63,7 @@ export class OpenApiClientCommand implements CliCommandShape {
|
|
|
62
63
|
|
|
63
64
|
const propList = await this.getPropList(format);
|
|
64
65
|
|
|
65
|
-
const
|
|
66
|
+
const proc = await cmd.run([
|
|
66
67
|
'generate',
|
|
67
68
|
'--skip-validate-spec',
|
|
68
69
|
'--remove-operation-id-prefix',
|
|
@@ -73,7 +74,7 @@ export class OpenApiClientCommand implements CliCommandShape {
|
|
|
73
74
|
...(propList ? ['--additional-properties', propList] : [])
|
|
74
75
|
]);
|
|
75
76
|
|
|
76
|
-
const result = await
|
|
77
|
+
const result = await ExecUtil.getResult(proc);
|
|
77
78
|
if (!result.valid) {
|
|
78
79
|
process.exitCode = 1;
|
|
79
80
|
}
|