oas-normalize 8.2.0 → 8.3.1
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 +8 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -0
- package/package.json +11 -11
- package/src/index.ts +5 -2
package/README.md
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/npm/v/oas-normalize
|
|
13
|
-
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/node/v/oas-normalize
|
|
14
|
-
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/npm/l/oas-normalize
|
|
15
|
-
<a href="https://github.com/readmeio/oas-normalize"><img src="https://img.shields.io/github/workflow/status/readmeio/oas-normalize/
|
|
12
|
+
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/npm/v/oas-normalize?style=for-the-badge" alt="NPM Version"></a>
|
|
13
|
+
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/node/v/oas-normalize?style=for-the-badge" alt="Node Version"></a>
|
|
14
|
+
<a href="https://npm.im/oas-normalize"><img src="https://img.shields.io/npm/l/oas-normalize?style=for-the-badge" alt="MIT License"></a>
|
|
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
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://readme.com"><img src="https://raw.githubusercontent.com/readmeio/.github/main/oss-badge.svg" /></a>
|
|
16
20
|
</p>
|
|
17
21
|
|
|
18
22
|
## Installation
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { OpenAPI } from 'openapi-types';
|
|
2
2
|
import openapiParser from '@readme/openapi-parser';
|
|
3
3
|
import * as utils from './lib/utils';
|
|
4
|
-
export
|
|
4
|
+
export interface Options {
|
|
5
5
|
colorizeErrors?: boolean;
|
|
6
6
|
enablePaths?: boolean;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
export declare const isAPIDefinition: typeof utils.isAPIDefinition;
|
|
9
9
|
export declare const getAPIDefinitionType: typeof utils.getAPIDefinitionType;
|
|
10
10
|
export default class OASNormalize {
|
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
|
+
"version": "8.3.1",
|
|
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",
|
|
@@ -42,25 +42,25 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@readme/openapi-parser": "^2.
|
|
45
|
+
"@readme/openapi-parser": "^2.4.0",
|
|
46
46
|
"js-yaml": "^4.1.0",
|
|
47
47
|
"node-fetch": "^2.6.1",
|
|
48
|
-
"openapi-types": "^12.
|
|
49
|
-
"postman-to-openapi": "^
|
|
48
|
+
"openapi-types": "^12.1.0",
|
|
49
|
+
"postman-to-openapi": "^3.0.0",
|
|
50
50
|
"swagger2openapi": "^7.0.8"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@readme/eslint-config": "^10.
|
|
53
|
+
"@readme/eslint-config": "^10.3.2",
|
|
54
54
|
"@readme/oas-examples": "^5.8.1",
|
|
55
|
-
"@types/jest": "^
|
|
55
|
+
"@types/jest": "^29.2.5",
|
|
56
56
|
"@types/js-yaml": "^4.0.5",
|
|
57
57
|
"@types/node-fetch": "^2.6.2",
|
|
58
|
-
"eslint": "^8.
|
|
59
|
-
"jest": "^
|
|
58
|
+
"eslint": "^8.31.0",
|
|
59
|
+
"jest": "^29.3.1",
|
|
60
60
|
"nock": "^13.2.4",
|
|
61
|
-
"prettier": "^2.
|
|
62
|
-
"ts-jest": "^
|
|
63
|
-
"typescript": "^4.
|
|
61
|
+
"prettier": "^2.8.1",
|
|
62
|
+
"ts-jest": "^29.0.3",
|
|
63
|
+
"typescript": "^4.9.4"
|
|
64
64
|
},
|
|
65
65
|
"prettier": "@readme/eslint-config/prettier"
|
|
66
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,10 +10,10 @@ import converter from 'swagger2openapi';
|
|
|
10
10
|
|
|
11
11
|
import * as utils from './lib/utils';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export interface Options {
|
|
14
14
|
colorizeErrors?: boolean;
|
|
15
15
|
enablePaths?: boolean;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
export const isAPIDefinition = utils.isAPIDefinition;
|
|
19
19
|
export const getAPIDefinitionType = utils.getAPIDefinitionType;
|
|
@@ -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:
|