@travetto/openapi 3.1.0 → 3.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/package.json +6 -6
- package/src/service.ts +6 -1
- package/support/cli.openapi_client.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/openapi",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "OpenAPI integration support for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rest",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"directory": "module/openapi"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^3.1.
|
|
30
|
-
"@travetto/rest": "^3.1.
|
|
31
|
-
"@travetto/schema": "^3.1.
|
|
32
|
-
"@travetto/yaml": "^3.1.
|
|
29
|
+
"@travetto/config": "^3.1.1",
|
|
30
|
+
"@travetto/rest": "^3.1.1",
|
|
31
|
+
"@travetto/schema": "^3.1.1",
|
|
32
|
+
"@travetto/yaml": "^3.1.1",
|
|
33
33
|
"openapi3-ts": "^3.1.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/cli": "^3.1.
|
|
36
|
+
"@travetto/cli": "^3.1.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import os from 'os';
|
|
1
2
|
import fs from 'fs/promises';
|
|
2
3
|
import type { OpenAPIObject } from 'openapi3-ts';
|
|
3
4
|
|
|
5
|
+
import { Util } from '@travetto/base';
|
|
4
6
|
import { path } from '@travetto/manifest';
|
|
5
7
|
import { Injectable, Inject } from '@travetto/di';
|
|
6
8
|
import { ControllerRegistry, RestConfig } from '@travetto/rest';
|
|
@@ -81,7 +83,10 @@ export class OpenApiService {
|
|
|
81
83
|
|
|
82
84
|
// TODO: Should use file abstraction
|
|
83
85
|
await fs.mkdir(path.dirname(this.apiSpecConfig.output), { recursive: true });
|
|
84
|
-
|
|
86
|
+
const tempFile = path.resolve(os.tmpdir(), `${Util.uuid()}.yml`);
|
|
87
|
+
await fs.writeFile(tempFile, output);
|
|
88
|
+
await fs.copyFile(tempFile, this.apiSpecConfig.output);
|
|
89
|
+
await fs.unlink(tempFile);
|
|
85
90
|
} catch (err) {
|
|
86
91
|
console.error('Unable to persist openapi spec', err);
|
|
87
92
|
}
|
|
@@ -30,6 +30,9 @@ export class OpenApiClientCommand implements CliCommandShape {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async main(format: string): Promise<void> {
|
|
33
|
+
this.output = path.resolve(this.output);
|
|
34
|
+
this.input = path.resolve(this.input);
|
|
35
|
+
|
|
33
36
|
// Ensure its there
|
|
34
37
|
await fs.mkdir(this.output, { recursive: true });
|
|
35
38
|
|