@redocly/openapi-core 0.0.0-snapshot.1737556585 → 0.0.0-snapshot.1737627998

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RegistryApi = void 0;
4
+ const node_fetch_1 = require("node-fetch");
4
5
  const utils_1 = require("../utils");
5
6
  const domains_1 = require("./domains");
6
7
  const version = require('../../package.json').version;
@@ -29,12 +30,7 @@ class RegistryApi {
29
30
  if (!headers.hasOwnProperty('authorization')) {
30
31
  throw new Error('Unauthorized');
31
32
  }
32
- const requestOptions = {
33
- ...options,
34
- headers,
35
- agent: (0, utils_1.getProxyAgent)(),
36
- };
37
- const response = await fetch(`${this.getBaseUrl()}${path}`, requestOptions);
33
+ const response = await (0, node_fetch_1.default)(`${this.getBaseUrl()}${path}`, Object.assign({}, options, { headers, agent: (0, utils_1.getProxyAgent)() }));
38
34
  if (response.status === 401) {
39
35
  throw new Error('Unauthorized');
40
36
  }
package/lib/rules/ajv.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseAjvInstance = releaseAjvInstance;
4
4
  exports.validateJsonSchema = validateJsonSchema;
5
5
  const _2020_1 = require("@redocly/ajv/dist/2020");
6
+ const ajv_formats_1 = require("ajv-formats");
6
7
  const ref_utils_1 = require("../ref-utils");
7
8
  let ajvInstance = null;
8
9
  function releaseAjvInstance() {
@@ -19,7 +20,7 @@ function getAjv(resolve, allowAdditionalProperties) {
19
20
  validateSchema: false,
20
21
  discriminator: true,
21
22
  allowUnionTypes: true,
22
- validateFormats: false, // TODO: fix it
23
+ validateFormats: true,
23
24
  defaultUnevaluatedProperties: allowAdditionalProperties,
24
25
  loadSchemaSync(base, $ref, $id) {
25
26
  const resolvedRef = resolve({ $ref }, base.split('#')[0]);
@@ -29,6 +30,7 @@ function getAjv(resolve, allowAdditionalProperties) {
29
30
  },
30
31
  logger: false,
31
32
  });
33
+ (0, ajv_formats_1.default)(ajvInstance); // FIXME: type mismatch
32
34
  }
33
35
  return ajvInstance;
34
36
  }
@@ -27,7 +27,7 @@ const ValidContentExamples = (opts) => {
27
27
  location = isMultiple ? resolved.location.child('value') : resolved.location;
28
28
  example = resolved.node;
29
29
  }
30
- if (isMultiple && typeof example.value === 'undefined') {
30
+ if (isMultiple && typeof example?.value === 'undefined') {
31
31
  return;
32
32
  }
33
33
  (0, utils_1.validateExample)(isMultiple ? example.value : example, mediaType.schema, location, ctx, allowAdditionalProperties);
package/lib/utils.js CHANGED
@@ -40,6 +40,7 @@ exports.dequal = dequal;
40
40
  const fs = require("fs");
41
41
  const path_1 = require("path");
42
42
  const minimatch = require("minimatch");
43
+ const node_fetch_1 = require("node-fetch");
43
44
  const js_yaml_1 = require("./js-yaml");
44
45
  const env_1 = require("./env");
45
46
  const logger_1 = require("./logger");
@@ -90,7 +91,7 @@ async function readFileFromUrl(url, config) {
90
91
  header.envVariable !== undefined ? env_1.env[header.envVariable] || '' : header.value;
91
92
  }
92
93
  }
93
- const req = await (config.customFetch || fetch)(url, {
94
+ const req = await (config.customFetch || node_fetch_1.default)(url, {
94
95
  headers: headers,
95
96
  });
96
97
  if (!req.ok) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@redocly/openapi-core",
3
- "version": "0.0.0-snapshot.1737556585",
3
+ "version": "0.0.0-snapshot.1737627998",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "engines": {
7
- "node": ">=18.17.0",
8
- "npm": ">=10.8.2"
7
+ "node": ">=14.19.0",
8
+ "npm": ">=7.0.0"
9
9
  },
10
10
  "engineStrict": true,
11
11
  "license": "MIT",
@@ -17,6 +17,7 @@
17
17
  "fs": false,
18
18
  "path": "path-browserify",
19
19
  "os": false,
20
+ "node-fetch": false,
20
21
  "colorette": false,
21
22
  "https-proxy-agent": false
22
23
  },
@@ -36,11 +37,13 @@
36
37
  "dependencies": {
37
38
  "@redocly/ajv": "^8.11.2",
38
39
  "@redocly/config": "^0.20.1",
40
+ "ajv-formats": "^3.0.1",
39
41
  "colorette": "^1.2.0",
40
- "https-proxy-agent": "^7.0.5",
42
+ "https-proxy-agent": "^7.0.4",
41
43
  "js-levenshtein": "^1.1.6",
42
44
  "js-yaml": "^4.1.0",
43
45
  "minimatch": "^5.0.1",
46
+ "node-fetch": "^2.6.1",
44
47
  "pluralize": "^8.0.0",
45
48
  "yaml-ast-parser": "0.0.43"
46
49
  },
@@ -48,6 +51,8 @@
48
51
  "@types/js-levenshtein": "^1.1.0",
49
52
  "@types/js-yaml": "^4.0.3",
50
53
  "@types/minimatch": "^3.0.5",
54
+ "@types/node": "^20.11.5",
55
+ "@types/node-fetch": "^2.5.7",
51
56
  "@types/pluralize": "^0.0.29",
52
57
  "json-schema-to-ts": "^3.1.0",
53
58
  "typescript": "5.5.3"