@travetto/openapi 3.0.0-rc.1 → 3.0.0-rc.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 +4 -4
- package/src/service.ts +9 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/openapi",
|
|
3
3
|
"displayName": "OpenAPI Specification",
|
|
4
|
-
"version": "3.0.0-rc.
|
|
4
|
+
"version": "3.0.0-rc.2",
|
|
5
5
|
"description": "OpenAPI integration support for the travetto framework",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rest",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"directory": "module/openapi"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/config": "^3.0.0-rc.
|
|
32
|
-
"@travetto/rest": "^3.0.0-rc.
|
|
33
|
-
"@travetto/schema": "^3.0.0-rc.
|
|
31
|
+
"@travetto/config": "^3.0.0-rc.2",
|
|
32
|
+
"@travetto/rest": "^3.0.0-rc.2",
|
|
33
|
+
"@travetto/schema": "^3.0.0-rc.2",
|
|
34
34
|
"@travetto/yaml": "^3.0.0-rc.0",
|
|
35
35
|
"openapi3-ts": "^2.0.2"
|
|
36
36
|
},
|
package/src/service.ts
CHANGED
|
@@ -71,12 +71,16 @@ export class OpenApiService {
|
|
|
71
71
|
* Persist to local file
|
|
72
72
|
*/
|
|
73
73
|
async persist(): Promise<void> {
|
|
74
|
-
|
|
74
|
+
try {
|
|
75
|
+
console.debug('Generating OpenAPI Spec', { output: this.apiSpecConfig.output });
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const output = this.apiSpecConfig.output.endsWith('.json') ?
|
|
78
|
+
JSON.stringify(this.spec, undefined, 2) :
|
|
79
|
+
YamlUtil.serialize(this.spec);
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
await fs.writeFile(this.apiSpecConfig.output, output);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.error('Unable to persist openapi spec', err);
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
}
|