oas-normalize 8.3.0 → 8.3.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 +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -0
- package/package.json +10 -10
- package/src/index.ts +4 -1
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
<a href="https://github.com/readmeio/oas-normalize"><img src="https://img.shields.io/github/actions/workflow/status/readmeio/oas-normalize/ci.yml?branch=main&style=for-the-badge" alt="Build status"></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://readme.com"><img src="https://raw.githubusercontent.com/readmeio/.github/main/oss-badge.svg" /></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
20
24
|
```bash
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -132,6 +132,9 @@ var OASNormalize = /** @class */ (function () {
|
|
|
132
132
|
return [2 /*return*/, Promise.reject(new Error('Use `opts.enablePaths` to enable accessing local files.'))];
|
|
133
133
|
}
|
|
134
134
|
contents = fs_1["default"].readFileSync(this.file).toString();
|
|
135
|
+
if (!contents.trim()) {
|
|
136
|
+
return [2 /*return*/, Promise.reject(new Error('No file contents found.'))];
|
|
137
|
+
}
|
|
135
138
|
return [2 /*return*/, resolve(contents)];
|
|
136
139
|
case 6: return [2 /*return*/, Promise.reject(new Error('Could not load this file.'))];
|
|
137
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oas-normalize",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"description": "Tooling for converting, valiating, and parsing OpenAPI, Swagger, and Postman API definitions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
"js-yaml": "^4.1.0",
|
|
47
47
|
"node-fetch": "^2.6.1",
|
|
48
48
|
"openapi-types": "^12.1.0",
|
|
49
|
-
"postman-to-openapi": "^3.0.
|
|
49
|
+
"postman-to-openapi": "^3.0.1",
|
|
50
50
|
"swagger2openapi": "^7.0.8"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@readme/eslint-config": "^10.
|
|
53
|
+
"@readme/eslint-config": "^10.5.0",
|
|
54
54
|
"@readme/oas-examples": "^5.8.1",
|
|
55
|
-
"@types/jest": "^29.
|
|
55
|
+
"@types/jest": "^29.4.0",
|
|
56
56
|
"@types/js-yaml": "^4.0.5",
|
|
57
57
|
"@types/node-fetch": "^2.6.2",
|
|
58
|
-
"eslint": "^8.
|
|
59
|
-
"jest": "^29.
|
|
60
|
-
"nock": "^13.
|
|
61
|
-
"prettier": "^2.8.
|
|
62
|
-
"ts-jest": "^29.0.
|
|
63
|
-
"typescript": "^4.9.
|
|
58
|
+
"eslint": "^8.33.0",
|
|
59
|
+
"jest": "^29.4.1",
|
|
60
|
+
"nock": "^13.3.0",
|
|
61
|
+
"prettier": "^2.8.3",
|
|
62
|
+
"ts-jest": "^29.0.5",
|
|
63
|
+
"typescript": "^4.9.5"
|
|
64
64
|
},
|
|
65
65
|
"prettier": "@readme/eslint-config/prettier"
|
|
66
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ export default class OASNormalize {
|
|
|
29
29
|
|
|
30
30
|
opts: Options;
|
|
31
31
|
|
|
32
|
-
type:
|
|
32
|
+
type: ReturnType<typeof utils.getType>;
|
|
33
33
|
|
|
34
34
|
constructor(file: any, opts?: Options) {
|
|
35
35
|
this.file = file;
|
|
@@ -80,6 +80,9 @@ export default class OASNormalize {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const contents = fs.readFileSync(this.file).toString();
|
|
83
|
+
if (!contents.trim()) {
|
|
84
|
+
return Promise.reject(new Error('No file contents found.'));
|
|
85
|
+
}
|
|
83
86
|
return resolve(contents);
|
|
84
87
|
|
|
85
88
|
default:
|