oas-normalize 8.3.3 → 8.4.0

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/dist/lib/utils.js CHANGED
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  exports.__esModule = true;
6
26
  exports.getAPIDefinitionType = exports.isAPIDefinition = exports.stringToJSON = exports.isSwagger = exports.isPostman = exports.isOpenAPI = exports.getType = exports.normalizeURL = exports.isBuffer = void 0;
7
- var js_yaml_1 = __importDefault(require("js-yaml"));
27
+ var js_yaml_1 = __importStar(require("js-yaml"));
8
28
  /**
9
29
  * Determine if a given variable is a `Buffer`.
10
30
  *
@@ -95,7 +115,7 @@ function stringToJSON(string) {
95
115
  else if (string.match(/^\s*{/)) {
96
116
  return JSON.parse(string);
97
117
  }
98
- return js_yaml_1["default"].load(string);
118
+ return js_yaml_1["default"].load(string, { schema: js_yaml_1.JSON_SCHEMA });
99
119
  }
100
120
  exports.stringToJSON = stringToJSON;
101
121
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oas-normalize",
3
- "version": "8.3.3",
3
+ "version": "8.4.0",
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,7 +42,7 @@
42
42
  },
43
43
  "license": "MIT",
44
44
  "dependencies": {
45
- "@readme/openapi-parser": "^2.4.0",
45
+ "@readme/openapi-parser": "^2.5.0",
46
46
  "@readme/postman-to-openapi": "^4.0.0",
47
47
  "js-yaml": "^4.1.0",
48
48
  "node-fetch": "^2.6.1",
@@ -50,15 +50,15 @@
50
50
  "swagger2openapi": "^7.0.8"
51
51
  },
52
52
  "devDependencies": {
53
- "@readme/eslint-config": "^10.5.0",
54
- "@readme/oas-examples": "^5.8.1",
55
- "@types/jest": "^29.4.0",
53
+ "@readme/eslint-config": "^10.5.1",
54
+ "@readme/oas-examples": "^5.10.0",
55
+ "@types/jest": "^29.5.0",
56
56
  "@types/js-yaml": "^4.0.5",
57
57
  "@types/node-fetch": "^2.6.2",
58
- "eslint": "^8.33.0",
59
- "jest": "^29.4.1",
58
+ "eslint": "^8.36.0",
59
+ "jest": "^29.5.0",
60
60
  "nock": "^13.3.0",
61
- "prettier": "^2.8.3",
61
+ "prettier": "^2.8.7",
62
62
  "ts-jest": "^29.0.5",
63
63
  "typescript": "^4.9.5"
64
64
  },
package/src/lib/utils.ts CHANGED
@@ -1,5 +1,4 @@
1
- import YAML from 'js-yaml';
2
-
1
+ import YAML, { JSON_SCHEMA } from 'js-yaml';
3
2
  /**
4
3
  * Determine if a given variable is a `Buffer`.
5
4
  *
@@ -90,7 +89,7 @@ export function stringToJSON(string: string | Record<string, unknown>) {
90
89
  return JSON.parse(string);
91
90
  }
92
91
 
93
- return YAML.load(string);
92
+ return YAML.load(string, { schema: JSON_SCHEMA });
94
93
  }
95
94
 
96
95
  /**