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 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
@@ -15,7 +15,7 @@ export default class OASNormalize {
15
15
  };
16
16
  file: any;
17
17
  opts: Options;
18
- type: boolean | string;
18
+ type: ReturnType<typeof utils.getType>;
19
19
  constructor(file: any, opts?: Options);
20
20
  /**
21
21
  * @private
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.0",
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.0",
49
+ "postman-to-openapi": "^3.0.1",
50
50
  "swagger2openapi": "^7.0.8"
51
51
  },
52
52
  "devDependencies": {
53
- "@readme/eslint-config": "^10.3.2",
53
+ "@readme/eslint-config": "^10.5.0",
54
54
  "@readme/oas-examples": "^5.8.1",
55
- "@types/jest": "^29.2.5",
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.31.0",
59
- "jest": "^29.3.1",
60
- "nock": "^13.2.4",
61
- "prettier": "^2.8.1",
62
- "ts-jest": "^29.0.3",
63
- "typescript": "^4.9.4"
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: boolean | string;
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: