@redocly/openapi-core 1.9.0 → 1.10.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/CHANGELOG.md +12 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +2 -2
- package/lib/config/config.d.ts +0 -6
- package/lib/config/config.js +1 -19
- package/lib/config/load.js +2 -2
- package/lib/decorators/common/registry-dependencies.js +2 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.js +17 -2
- package/lib/lint.d.ts +1 -0
- package/lib/lint.js +1 -1
- package/lib/oas-types.d.ts +1 -1
- package/lib/redocly/domains.d.ts +14 -0
- package/lib/redocly/domains.js +41 -0
- package/lib/redocly/index.d.ts +1 -2
- package/lib/redocly/index.js +14 -24
- package/lib/redocly/registry-api.d.ts +2 -2
- package/lib/redocly/registry-api.js +9 -9
- package/lib/ref-utils.js +2 -2
- package/lib/resolve.js +9 -1
- package/lib/types/index.d.ts +7 -7
- package/lib/types/json-schema-adapter.d.ts +3 -0
- package/lib/types/json-schema-adapter.js +173 -0
- package/lib/types/oas2.d.ts +3 -2
- package/lib/types/oas3.d.ts +3 -2
- package/lib/types/oas3_1.d.ts +3 -2
- package/lib/types/portal-config-schema.d.ts +5261 -52
- package/lib/types/portal-config-schema.js +71 -55
- package/lib/types/redocly-yaml.d.ts +13 -1
- package/lib/types/redocly-yaml.js +101 -39
- package/lib/types/theme-config.d.ts +819 -36
- package/lib/types/theme-config.js +67 -29
- package/lib/utils.d.ts +4 -2
- package/lib/utils.js +7 -1
- package/lib/visitors.js +1 -1
- package/lib/walk.js +7 -1
- package/package.json +2 -1
- package/src/__tests__/lint.test.ts +1218 -36
- package/src/__tests__/ref-utils.test.ts +22 -0
- package/src/bundle.ts +1 -1
- package/src/config/__tests__/load.test.ts +13 -13
- package/src/config/config.ts +1 -23
- package/src/config/load.ts +2 -1
- package/src/decorators/common/registry-dependencies.ts +1 -1
- package/src/decorators/oas2/remove-unused-components.ts +3 -2
- package/src/decorators/oas3/remove-unused-components.ts +3 -2
- package/src/index.ts +11 -2
- package/src/lint.ts +2 -1
- package/src/redocly/__tests__/domains.test.ts +52 -0
- package/src/redocly/__tests__/redocly-client.test.ts +5 -3
- package/src/redocly/domains.ts +48 -0
- package/src/redocly/index.ts +14 -24
- package/src/redocly/registry-api.ts +25 -31
- package/src/ref-utils.ts +2 -2
- package/src/resolve.ts +13 -1
- package/src/types/index.ts +7 -12
- package/src/types/json-schema-adapter.ts +217 -0
- package/src/types/oas2.ts +5 -2
- package/src/types/oas3.ts +6 -2
- package/src/types/oas3_1.ts +5 -2
- package/src/types/portal-config-schema.ts +111 -61
- package/src/types/redocly-yaml.ts +118 -43
- package/src/types/theme-config.ts +125 -27
- package/src/utils.ts +9 -3
- package/src/visitors.ts +1 -1
- package/src/walk.ts +7 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.productThemeOverrideSchema = exports.themeConfigSchema = void 0;
|
|
4
4
|
const logoConfigSchema = {
|
|
5
5
|
type: 'object',
|
|
6
6
|
properties: {
|
|
@@ -67,13 +67,18 @@ const markdownConfigSchema = {
|
|
|
67
67
|
items: { type: 'string' },
|
|
68
68
|
default: ['image', 'links'],
|
|
69
69
|
},
|
|
70
|
+
partialsFolders: {
|
|
71
|
+
type: 'array',
|
|
72
|
+
items: { type: 'string' },
|
|
73
|
+
default: ['_partials'],
|
|
74
|
+
},
|
|
70
75
|
lastUpdatedBlock: {
|
|
71
76
|
type: 'object',
|
|
72
77
|
properties: Object.assign({ format: {
|
|
73
78
|
type: 'string',
|
|
74
79
|
enum: ['timeago', 'iso', 'long', 'short'],
|
|
75
80
|
default: 'timeago',
|
|
76
|
-
}, locale: { type: 'string'
|
|
81
|
+
}, locale: { type: 'string' } }, hideConfigSchema.properties),
|
|
77
82
|
additionalProperties: false,
|
|
78
83
|
default: {},
|
|
79
84
|
},
|
|
@@ -168,6 +173,19 @@ const gtmAnalyticsConfigSchema = {
|
|
|
168
173
|
additionalProperties: false,
|
|
169
174
|
required: ['trackingId'],
|
|
170
175
|
};
|
|
176
|
+
const productGoogleAnalyticsConfigSchema = {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
includeInDevelopment: { type: 'boolean' },
|
|
180
|
+
trackingId: { type: 'string' },
|
|
181
|
+
conversionId: { type: 'string' },
|
|
182
|
+
floodlightId: { type: 'string' },
|
|
183
|
+
optimizeId: { type: 'string' },
|
|
184
|
+
exclude: { type: 'array', items: { type: 'string' } },
|
|
185
|
+
},
|
|
186
|
+
additionalProperties: false,
|
|
187
|
+
required: ['trackingId'],
|
|
188
|
+
};
|
|
171
189
|
const googleAnalyticsConfigSchema = {
|
|
172
190
|
type: 'object',
|
|
173
191
|
properties: {
|
|
@@ -181,6 +199,11 @@ const googleAnalyticsConfigSchema = {
|
|
|
181
199
|
optimizeId: { type: 'string' },
|
|
182
200
|
anonymizeIp: { type: 'boolean' },
|
|
183
201
|
cookieExpires: { type: 'number' },
|
|
202
|
+
// All enabled tracking configs
|
|
203
|
+
trackers: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
additionalProperties: productGoogleAnalyticsConfigSchema,
|
|
206
|
+
},
|
|
184
207
|
},
|
|
185
208
|
additionalProperties: false,
|
|
186
209
|
required: ['trackingId'],
|
|
@@ -200,6 +223,7 @@ const navItemSchema = {
|
|
|
200
223
|
properties: {
|
|
201
224
|
page: { type: 'string' },
|
|
202
225
|
directory: { type: 'string' },
|
|
226
|
+
disconnect: { type: 'boolean', default: false },
|
|
203
227
|
group: { type: 'string' },
|
|
204
228
|
label: { type: 'string' },
|
|
205
229
|
separator: { type: 'string' },
|
|
@@ -232,7 +256,7 @@ const productConfigSchema = {
|
|
|
232
256
|
folder: { type: 'string' },
|
|
233
257
|
},
|
|
234
258
|
additionalProperties: false,
|
|
235
|
-
required: ['name', '
|
|
259
|
+
required: ['name', 'folder'],
|
|
236
260
|
};
|
|
237
261
|
const suggestedPageSchema = {
|
|
238
262
|
type: 'object',
|
|
@@ -253,6 +277,7 @@ const catalogFilterSchema = {
|
|
|
253
277
|
titleTranslationKey: { type: 'string' },
|
|
254
278
|
property: { type: 'string' },
|
|
255
279
|
parentFilter: { type: 'string' },
|
|
280
|
+
valuesMapping: { type: 'object', additionalProperties: { type: 'string' } },
|
|
256
281
|
missingCategoryName: { type: 'string' },
|
|
257
282
|
missingCategoryNameTranslationKey: { type: 'string' },
|
|
258
283
|
options: { type: 'array', items: { type: 'string' } },
|
|
@@ -261,9 +286,9 @@ const catalogFilterSchema = {
|
|
|
261
286
|
const scorecardConfigSchema = {
|
|
262
287
|
type: 'object',
|
|
263
288
|
additionalProperties: true,
|
|
264
|
-
required: [
|
|
289
|
+
required: [],
|
|
265
290
|
properties: {
|
|
266
|
-
|
|
291
|
+
ignoreNonCompliant: { type: 'boolean', default: false },
|
|
267
292
|
teamMetadataProperty: {
|
|
268
293
|
type: 'object',
|
|
269
294
|
properties: {
|
|
@@ -279,11 +304,12 @@ const scorecardConfigSchema = {
|
|
|
279
304
|
required: ['name'],
|
|
280
305
|
properties: {
|
|
281
306
|
name: { type: 'string' },
|
|
307
|
+
color: { type: 'string' },
|
|
282
308
|
extends: { type: 'array', items: { type: 'string' } },
|
|
283
309
|
rules: {
|
|
284
310
|
type: 'object',
|
|
285
311
|
additionalProperties: {
|
|
286
|
-
type:
|
|
312
|
+
oneOf: [{ type: 'string' }, { type: 'object' }],
|
|
287
313
|
},
|
|
288
314
|
},
|
|
289
315
|
},
|
|
@@ -370,12 +396,6 @@ exports.themeConfigSchema = {
|
|
|
370
396
|
} }, hideConfigSchema.properties),
|
|
371
397
|
additionalProperties: false,
|
|
372
398
|
},
|
|
373
|
-
seo: {
|
|
374
|
-
type: 'object',
|
|
375
|
-
properties: {
|
|
376
|
-
title: { type: 'string' },
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
399
|
scripts: {
|
|
380
400
|
type: 'object',
|
|
381
401
|
properties: {
|
|
@@ -394,21 +414,33 @@ exports.themeConfigSchema = {
|
|
|
394
414
|
},
|
|
395
415
|
type: {
|
|
396
416
|
type: 'string',
|
|
397
|
-
enum: ['rating', 'sentiment', 'comment', 'reasons'],
|
|
417
|
+
enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
|
|
398
418
|
default: 'sentiment',
|
|
399
419
|
},
|
|
400
420
|
settings: Object.assign({ type: 'object', properties: {
|
|
401
421
|
label: { type: 'string' },
|
|
402
422
|
submitText: { type: 'string' },
|
|
403
|
-
max: { type: 'number' },
|
|
404
423
|
buttonText: { type: 'string' },
|
|
405
|
-
|
|
424
|
+
component: {
|
|
425
|
+
type: 'string',
|
|
426
|
+
enum: ['radio', 'checkbox'],
|
|
427
|
+
default: 'checkbox',
|
|
428
|
+
},
|
|
406
429
|
items: { type: 'array', items: { type: 'string' }, minItems: 1 },
|
|
430
|
+
leftScaleLabel: { type: 'string' },
|
|
431
|
+
rightScaleLabel: { type: 'string' },
|
|
407
432
|
reasons: {
|
|
408
433
|
type: 'object',
|
|
409
434
|
properties: {
|
|
410
|
-
|
|
411
|
-
|
|
435
|
+
hide: {
|
|
436
|
+
type: 'boolean',
|
|
437
|
+
default: false,
|
|
438
|
+
},
|
|
439
|
+
component: {
|
|
440
|
+
type: 'string',
|
|
441
|
+
enum: ['radio', 'checkbox'],
|
|
442
|
+
default: 'checkbox',
|
|
443
|
+
},
|
|
412
444
|
label: { type: 'string' },
|
|
413
445
|
items: { type: 'array', items: { type: 'string' } },
|
|
414
446
|
},
|
|
@@ -417,10 +449,16 @@ exports.themeConfigSchema = {
|
|
|
417
449
|
comment: {
|
|
418
450
|
type: 'object',
|
|
419
451
|
properties: {
|
|
420
|
-
|
|
452
|
+
hide: {
|
|
453
|
+
type: 'boolean',
|
|
454
|
+
default: false,
|
|
455
|
+
},
|
|
421
456
|
label: { type: 'string' },
|
|
422
457
|
likeLabel: { type: 'string' },
|
|
423
458
|
dislikeLabel: { type: 'string' },
|
|
459
|
+
satisfiedLabel: { type: 'string' },
|
|
460
|
+
neutralLabel: { type: 'string' },
|
|
461
|
+
dissatisfiedLabel: { type: 'string' },
|
|
424
462
|
},
|
|
425
463
|
additionalProperties: false,
|
|
426
464
|
},
|
|
@@ -460,13 +498,13 @@ exports.themeConfigSchema = {
|
|
|
460
498
|
properties: {
|
|
461
499
|
nextButton: {
|
|
462
500
|
type: 'object',
|
|
463
|
-
properties: Object.assign({ text: { type: 'string', default: 'Next to {label}' } }, hideConfigSchema.properties),
|
|
501
|
+
properties: Object.assign({ text: { type: 'string', default: 'Next to {{label}}' } }, hideConfigSchema.properties),
|
|
464
502
|
additionalProperties: false,
|
|
465
503
|
default: {},
|
|
466
504
|
},
|
|
467
505
|
previousButton: {
|
|
468
506
|
type: 'object',
|
|
469
|
-
properties: Object.assign({ text: { type: 'string', default: 'Back to {label}' } }, hideConfigSchema.properties),
|
|
507
|
+
properties: Object.assign({ text: { type: 'string', default: 'Back to {{label}}' } }, hideConfigSchema.properties),
|
|
470
508
|
additionalProperties: false,
|
|
471
509
|
default: {},
|
|
472
510
|
},
|
|
@@ -477,7 +515,7 @@ exports.themeConfigSchema = {
|
|
|
477
515
|
codeSnippet: {
|
|
478
516
|
type: 'object',
|
|
479
517
|
properties: {
|
|
480
|
-
|
|
518
|
+
elementFormat: { type: 'string', default: 'icon' },
|
|
481
519
|
copy: {
|
|
482
520
|
type: 'object',
|
|
483
521
|
properties: Object.assign({}, hideConfigSchema.properties),
|
|
@@ -486,9 +524,9 @@ exports.themeConfigSchema = {
|
|
|
486
524
|
},
|
|
487
525
|
report: {
|
|
488
526
|
type: 'object',
|
|
489
|
-
properties: Object.assign({}, hideConfigSchema.properties),
|
|
527
|
+
properties: Object.assign({ tooltipText: { type: 'string' }, buttonText: { type: 'string' }, label: { type: 'string' } }, hideConfigSchema.properties),
|
|
490
528
|
additionalProperties: false,
|
|
491
|
-
default: { hide:
|
|
529
|
+
default: { hide: false },
|
|
492
530
|
},
|
|
493
531
|
expand: {
|
|
494
532
|
type: 'object',
|
|
@@ -587,13 +625,13 @@ exports.productThemeOverrideSchema = {
|
|
|
587
625
|
search: exports.themeConfigSchema.properties.search,
|
|
588
626
|
codeSnippet: exports.themeConfigSchema.properties.codeSnippet,
|
|
589
627
|
breadcrumbs: exports.themeConfigSchema.properties.breadcrumbs,
|
|
628
|
+
analytics: {
|
|
629
|
+
type: 'object',
|
|
630
|
+
properties: {
|
|
631
|
+
ga: productGoogleAnalyticsConfigSchema,
|
|
632
|
+
},
|
|
633
|
+
},
|
|
590
634
|
},
|
|
591
635
|
additionalProperties: true,
|
|
592
636
|
default: {},
|
|
593
637
|
};
|
|
594
|
-
var ScorecardStatus;
|
|
595
|
-
(function (ScorecardStatus) {
|
|
596
|
-
ScorecardStatus["BelowMinimum"] = "Below minimum";
|
|
597
|
-
ScorecardStatus["Highest"] = "Highest";
|
|
598
|
-
ScorecardStatus["Minimum"] = "Minimum";
|
|
599
|
-
})(ScorecardStatus || (exports.ScorecardStatus = ScorecardStatus = {}));
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserContext } from './walk';
|
|
2
2
|
import { HttpResolveConfig } from './config';
|
|
3
|
+
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
3
4
|
export { parseYaml, stringifyYaml } from './js-yaml';
|
|
4
5
|
export type StackFrame<T> = {
|
|
5
6
|
prev: StackFrame<T> | null;
|
|
@@ -15,8 +16,8 @@ export declare function popStack<T, P extends Stack<T>>(head: P): StackFrame<T>
|
|
|
15
16
|
export type BundleOutputFormat = 'json' | 'yml' | 'yaml';
|
|
16
17
|
export declare function loadYaml<T>(filename: string): Promise<T>;
|
|
17
18
|
export declare function isDefined<T>(x: T | undefined): x is T;
|
|
18
|
-
export declare function isPlainObject(value: any): value is
|
|
19
|
-
export declare function isEmptyObject(value: any): value is
|
|
19
|
+
export declare function isPlainObject(value: any): value is Record<string, unknown>;
|
|
20
|
+
export declare function isEmptyObject(value: any): value is Record<string, unknown>;
|
|
20
21
|
export declare function isEmptyArray(value: any): boolean;
|
|
21
22
|
export declare function readFileFromUrl(url: string, config: HttpResolveConfig): Promise<{
|
|
22
23
|
body: any;
|
|
@@ -50,3 +51,4 @@ export declare function identity<T>(value: T): T;
|
|
|
50
51
|
export declare function keysOf<T>(obj: T): (keyof T)[];
|
|
51
52
|
export declare function pickDefined<T extends Record<string, unknown>>(obj?: T): Record<string, unknown> | undefined;
|
|
52
53
|
export declare function nextTick(): void;
|
|
54
|
+
export declare function getProxyAgent(): HttpsProxyAgent<string> | undefined;
|
package/lib/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.nextTick = exports.pickDefined = exports.keysOf = exports.identity = exports.isTruthy = exports.showErrorForDeprecatedField = exports.showWarningForDeprecatedField = exports.doesYamlFileExist = exports.isCustomRuleId = exports.getMatchingStatusCodeRange = exports.assignExisting = exports.isNotString = exports.isString = exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.yamlAndJsonSyncReader = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.readFileFromUrl = exports.isEmptyArray = exports.isEmptyObject = exports.isPlainObject = exports.isDefined = exports.loadYaml = exports.popStack = exports.pushStack = exports.stringifyYaml = exports.parseYaml = void 0;
|
|
12
|
+
exports.getProxyAgent = exports.nextTick = exports.pickDefined = exports.keysOf = exports.identity = exports.isTruthy = exports.showErrorForDeprecatedField = exports.showWarningForDeprecatedField = exports.doesYamlFileExist = exports.isCustomRuleId = exports.getMatchingStatusCodeRange = exports.assignExisting = exports.isNotString = exports.isString = exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.yamlAndJsonSyncReader = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.readFileFromUrl = exports.isEmptyArray = exports.isEmptyObject = exports.isPlainObject = exports.isDefined = exports.loadYaml = exports.popStack = exports.pushStack = exports.stringifyYaml = exports.parseYaml = void 0;
|
|
13
13
|
const fs = require("fs");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const minimatch = require("minimatch");
|
|
@@ -18,6 +18,7 @@ const pluralize = require("pluralize");
|
|
|
18
18
|
const js_yaml_1 = require("./js-yaml");
|
|
19
19
|
const env_1 = require("./env");
|
|
20
20
|
const logger_1 = require("./logger");
|
|
21
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
21
22
|
var js_yaml_2 = require("./js-yaml");
|
|
22
23
|
Object.defineProperty(exports, "parseYaml", { enumerable: true, get: function () { return js_yaml_2.parseYaml; } });
|
|
23
24
|
Object.defineProperty(exports, "stringifyYaml", { enumerable: true, get: function () { return js_yaml_2.stringifyYaml; } });
|
|
@@ -239,3 +240,8 @@ exports.nextTick = nextTick;
|
|
|
239
240
|
function getUpdatedFieldName(updatedField, updatedObject) {
|
|
240
241
|
return `${typeof updatedObject !== 'undefined' ? `${updatedObject}.` : ''}${updatedField}`;
|
|
241
242
|
}
|
|
243
|
+
function getProxyAgent() {
|
|
244
|
+
const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
245
|
+
return proxy ? new https_proxy_agent_1.HttpsProxyAgent(proxy) : undefined;
|
|
246
|
+
}
|
|
247
|
+
exports.getProxyAgent = getProxyAgent;
|
package/lib/visitors.js
CHANGED
|
@@ -61,7 +61,7 @@ function normalizeVisitors(visitorsConfig, types) {
|
|
|
61
61
|
possibleChildren.add(from.additionalProperties);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
if (from.items) {
|
|
64
|
+
if (from.items && typeof from.items !== 'function') {
|
|
65
65
|
if (from.items === to) {
|
|
66
66
|
addWeakFromStack(ruleConf, stack);
|
|
67
67
|
}
|
package/lib/walk.js
CHANGED
|
@@ -140,8 +140,14 @@ function walkDocument(opts) {
|
|
|
140
140
|
if (Array.isArray(resolvedNode)) {
|
|
141
141
|
const itemsType = type.items;
|
|
142
142
|
if (itemsType !== undefined) {
|
|
143
|
+
const isTypeAFunction = typeof itemsType === 'function';
|
|
143
144
|
for (let i = 0; i < resolvedNode.length; i++) {
|
|
144
|
-
|
|
145
|
+
const itemType = isTypeAFunction
|
|
146
|
+
? itemsType(resolvedNode[i], resolvedLocation.child([i]).absolutePointer)
|
|
147
|
+
: itemsType;
|
|
148
|
+
if ((0, types_1.isNamedType)(itemType)) {
|
|
149
|
+
walkNode(resolvedNode[i], itemType, resolvedLocation.child([i]), resolvedNode, i);
|
|
150
|
+
}
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@redocly/ajv": "^8.11.0",
|
|
38
38
|
"colorette": "^1.2.0",
|
|
39
|
+
"https-proxy-agent": "^7.0.4",
|
|
39
40
|
"js-levenshtein": "^1.1.6",
|
|
40
41
|
"js-yaml": "^4.1.0",
|
|
41
42
|
"lodash.isequal": "^4.5.0",
|