@redocly/openapi-core 0.0.0-snapshot.1737627998 → 0.0.0-snapshot.1739194003
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/lib/redocly/registry-api.js +6 -2
- package/lib/rules/ajv.js +1 -3
- package/lib/rules/oas3/no-invalid-media-type-examples.js +1 -1
- package/lib/types/arazzo.js +6 -4
- package/lib/types/redocly-yaml.js +12 -2
- package/lib/typings/arazzo.d.ts +1 -1
- package/lib/typings/arazzo.js +1 -1
- package/lib/utils.js +1 -2
- package/package.json +4 -9
|
@@ -1,7 +1,6 @@
|
|
|
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");
|
|
5
4
|
const utils_1 = require("../utils");
|
|
6
5
|
const domains_1 = require("./domains");
|
|
7
6
|
const version = require('../../package.json').version;
|
|
@@ -30,7 +29,12 @@ class RegistryApi {
|
|
|
30
29
|
if (!headers.hasOwnProperty('authorization')) {
|
|
31
30
|
throw new Error('Unauthorized');
|
|
32
31
|
}
|
|
33
|
-
const
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
...options,
|
|
34
|
+
headers,
|
|
35
|
+
agent: (0, utils_1.getProxyAgent)(),
|
|
36
|
+
};
|
|
37
|
+
const response = await fetch(`${this.getBaseUrl()}${path}`, requestOptions);
|
|
34
38
|
if (response.status === 401) {
|
|
35
39
|
throw new Error('Unauthorized');
|
|
36
40
|
}
|
package/lib/rules/ajv.js
CHANGED
|
@@ -3,7 +3,6 @@ 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");
|
|
7
6
|
const ref_utils_1 = require("../ref-utils");
|
|
8
7
|
let ajvInstance = null;
|
|
9
8
|
function releaseAjvInstance() {
|
|
@@ -20,7 +19,7 @@ function getAjv(resolve, allowAdditionalProperties) {
|
|
|
20
19
|
validateSchema: false,
|
|
21
20
|
discriminator: true,
|
|
22
21
|
allowUnionTypes: true,
|
|
23
|
-
validateFormats:
|
|
22
|
+
validateFormats: false, // TODO: fix it
|
|
24
23
|
defaultUnevaluatedProperties: allowAdditionalProperties,
|
|
25
24
|
loadSchemaSync(base, $ref, $id) {
|
|
26
25
|
const resolvedRef = resolve({ $ref }, base.split('#')[0]);
|
|
@@ -30,7 +29,6 @@ function getAjv(resolve, allowAdditionalProperties) {
|
|
|
30
29
|
},
|
|
31
30
|
logger: false,
|
|
32
31
|
});
|
|
33
|
-
(0, ajv_formats_1.default)(ajvInstance); // FIXME: type mismatch
|
|
34
32
|
}
|
|
35
33
|
return ajvInstance;
|
|
36
34
|
}
|
|
@@ -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
|
|
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/types/arazzo.js
CHANGED
|
@@ -175,19 +175,21 @@ const ExtendedOperation = {
|
|
|
175
175
|
'put',
|
|
176
176
|
'delete',
|
|
177
177
|
'patch',
|
|
178
|
+
'head',
|
|
179
|
+
'options',
|
|
180
|
+
'trace',
|
|
181
|
+
'connect',
|
|
182
|
+
'query',
|
|
178
183
|
'GET',
|
|
179
184
|
'POST',
|
|
180
185
|
'PUT',
|
|
181
186
|
'DELETE',
|
|
182
187
|
'PATCH',
|
|
183
|
-
'options',
|
|
184
188
|
'OPTIONS',
|
|
185
|
-
'head',
|
|
186
189
|
'HEAD',
|
|
187
|
-
'trace',
|
|
188
190
|
'TRACE',
|
|
189
|
-
'connect',
|
|
190
191
|
'CONNECT',
|
|
192
|
+
'QUERY',
|
|
191
193
|
],
|
|
192
194
|
},
|
|
193
195
|
},
|
|
@@ -359,11 +359,21 @@ const Rules = {
|
|
|
359
359
|
properties: {},
|
|
360
360
|
additionalProperties: (value, key) => {
|
|
361
361
|
if (key.startsWith('rule/')) {
|
|
362
|
-
|
|
362
|
+
if (typeof value === 'string') {
|
|
363
|
+
return { enum: ['error', 'warn', 'off'] };
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
return 'Assert';
|
|
367
|
+
}
|
|
363
368
|
}
|
|
364
369
|
else if (key.startsWith('assert/')) {
|
|
365
370
|
// keep the old assert/ prefix as an alias
|
|
366
|
-
|
|
371
|
+
if (typeof value === 'string') {
|
|
372
|
+
return { enum: ['error', 'warn', 'off'] };
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
return 'Assert';
|
|
376
|
+
}
|
|
367
377
|
}
|
|
368
378
|
else if (builtInRules.includes(key) || (0, utils_1.isCustomRuleId)(key)) {
|
|
369
379
|
if (typeof value === 'string') {
|
package/lib/typings/arazzo.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface Parameter {
|
|
|
24
24
|
}
|
|
25
25
|
export interface ExtendedOperation {
|
|
26
26
|
url: string;
|
|
27
|
-
method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'connect' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
|
|
27
|
+
method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'connect' | 'query' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT' | 'QUERY';
|
|
28
28
|
}
|
|
29
29
|
export interface Replacement {
|
|
30
30
|
target: string;
|
package/lib/typings/arazzo.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ARAZZO_VERSIONS_SUPPORTED_BY_SPOT = exports.VERSION_PATTERN = void 0;
|
|
4
4
|
exports.VERSION_PATTERN = /^1\.0\.\d+(-.+)?$/;
|
|
5
|
-
exports.ARAZZO_VERSIONS_SUPPORTED_BY_SPOT = ['1.0.0'];
|
|
5
|
+
exports.ARAZZO_VERSIONS_SUPPORTED_BY_SPOT = ['1.0.0', '1.0.1'];
|
package/lib/utils.js
CHANGED
|
@@ -40,7 +40,6 @@ 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");
|
|
44
43
|
const js_yaml_1 = require("./js-yaml");
|
|
45
44
|
const env_1 = require("./env");
|
|
46
45
|
const logger_1 = require("./logger");
|
|
@@ -91,7 +90,7 @@ async function readFileFromUrl(url, config) {
|
|
|
91
90
|
header.envVariable !== undefined ? env_1.env[header.envVariable] || '' : header.value;
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
const req = await (config.customFetch ||
|
|
93
|
+
const req = await (config.customFetch || fetch)(url, {
|
|
95
94
|
headers: headers,
|
|
96
95
|
});
|
|
97
96
|
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.
|
|
3
|
+
"version": "0.0.0-snapshot.1739194003",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
8
|
-
"npm": ">=
|
|
7
|
+
"node": ">=18.17.0",
|
|
8
|
+
"npm": ">=9.5.0"
|
|
9
9
|
},
|
|
10
10
|
"engineStrict": true,
|
|
11
11
|
"license": "MIT",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"fs": false,
|
|
18
18
|
"path": "path-browserify",
|
|
19
19
|
"os": false,
|
|
20
|
-
"node-fetch": false,
|
|
21
20
|
"colorette": false,
|
|
22
21
|
"https-proxy-agent": false
|
|
23
22
|
},
|
|
@@ -37,13 +36,11 @@
|
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@redocly/ajv": "^8.11.2",
|
|
39
38
|
"@redocly/config": "^0.20.1",
|
|
40
|
-
"ajv-formats": "^3.0.1",
|
|
41
39
|
"colorette": "^1.2.0",
|
|
42
|
-
"https-proxy-agent": "^7.0.
|
|
40
|
+
"https-proxy-agent": "^7.0.5",
|
|
43
41
|
"js-levenshtein": "^1.1.6",
|
|
44
42
|
"js-yaml": "^4.1.0",
|
|
45
43
|
"minimatch": "^5.0.1",
|
|
46
|
-
"node-fetch": "^2.6.1",
|
|
47
44
|
"pluralize": "^8.0.0",
|
|
48
45
|
"yaml-ast-parser": "0.0.43"
|
|
49
46
|
},
|
|
@@ -51,8 +48,6 @@
|
|
|
51
48
|
"@types/js-levenshtein": "^1.1.0",
|
|
52
49
|
"@types/js-yaml": "^4.0.3",
|
|
53
50
|
"@types/minimatch": "^3.0.5",
|
|
54
|
-
"@types/node": "^20.11.5",
|
|
55
|
-
"@types/node-fetch": "^2.5.7",
|
|
56
51
|
"@types/pluralize": "^0.0.29",
|
|
57
52
|
"json-schema-to-ts": "^3.1.0",
|
|
58
53
|
"typescript": "5.5.3"
|