openapi-explorer 2.4.820 → 2.4.836
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.
|
@@ -59,7 +59,7 @@ export function getTypeInfo(parameter, options = {
|
|
|
59
59
|
info.default = arrayItemDefault;
|
|
60
60
|
info.allowedValues = typeof schema.const !== 'undefined' && [schema.const] || schema.items.enum || null;
|
|
61
61
|
}
|
|
62
|
-
if (schema.uniqueItems) {
|
|
62
|
+
if (schema.uniqueItems && dataType.match(/array|\[\]/)) {
|
|
63
63
|
info.constraints.push('Requires unique items');
|
|
64
64
|
}
|
|
65
65
|
if (dataType.match(/integer|number/g)) {
|
|
@@ -360,7 +360,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
360
360
|
// If allOf is an array of multiple elements, then all the keys makes a single object
|
|
361
361
|
const objWithAllProps = {};
|
|
362
362
|
allOf.map((v, i) => {
|
|
363
|
-
if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
|
363
|
+
if (v.type === 'object' || v.properties || v.patternProperties || v.allOf || v.anyOf || v.oneOf) {
|
|
364
364
|
const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';
|
|
365
365
|
const partialObj = schemaInObjectNotation(v, options, level + 1, propSuffix);
|
|
366
366
|
Object.assign(objWithAllProps, partialObj);
|
|
@@ -386,7 +386,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
386
386
|
let writeOnly = true;
|
|
387
387
|
let readOnly = true;
|
|
388
388
|
(anyOf || oneOf || []).forEach((v, index) => {
|
|
389
|
-
if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf || v.type === 'array' || v.items) {
|
|
389
|
+
if (v.type === 'object' || v.properties || v.patternProperties || v.allOf || v.anyOf || v.oneOf || v.type === 'array' || v.items) {
|
|
390
390
|
const partialObj = schemaInObjectNotation(v, options);
|
|
391
391
|
if (partialObj) {
|
|
392
392
|
var _partialObj$Flags, _partialObj$Flags2;
|
|
@@ -419,6 +419,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
419
419
|
};
|
|
420
420
|
resultObj['::title'] = schema.title || '';
|
|
421
421
|
resultObj['::description'] = schema.description || '';
|
|
422
|
+
resultObj['::deprecated'] = schema.deprecated || false;
|
|
422
423
|
resultObj['::metadata'] = metadata;
|
|
423
424
|
return resultObj;
|
|
424
425
|
}
|
|
@@ -445,19 +446,30 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
445
446
|
complexTypes.push(v);
|
|
446
447
|
}
|
|
447
448
|
});
|
|
449
|
+
// Rendered as one option of several: title, description and deprecation belong to the property itself
|
|
450
|
+
const asPrimitiveOption = type => getTypeInfo({
|
|
451
|
+
...subSchema,
|
|
452
|
+
type,
|
|
453
|
+
title: undefined,
|
|
454
|
+
description: undefined,
|
|
455
|
+
deprecated: undefined
|
|
456
|
+
}, options);
|
|
448
457
|
let multiPrimitiveTypes;
|
|
449
458
|
if (primitiveType.length > 0) {
|
|
450
459
|
subSchema.type = primitiveType.join('┃');
|
|
451
|
-
multiPrimitiveTypes = getTypeInfo(subSchema, options);
|
|
452
460
|
if (complexTypes.length === 0) {
|
|
453
|
-
var
|
|
454
|
-
return `${((
|
|
461
|
+
var _getTypeInfo;
|
|
462
|
+
return `${((_getTypeInfo = getTypeInfo(subSchema, options)) === null || _getTypeInfo === void 0 ? void 0 : _getTypeInfo.html) || ''}`;
|
|
455
463
|
}
|
|
464
|
+
multiPrimitiveTypes = asPrimitiveOption(subSchema.type);
|
|
456
465
|
}
|
|
457
466
|
if (complexTypes.length > 0) {
|
|
458
467
|
obj['::link'] = schema.title || '';
|
|
459
468
|
obj['::circular'] = !!schema.circularReference;
|
|
460
469
|
obj['::type'] = 'object';
|
|
470
|
+
obj['::title'] = schema.title || '';
|
|
471
|
+
obj['::description'] = schema.description || '';
|
|
472
|
+
obj['::deprecated'] = schema.deprecated || false;
|
|
461
473
|
const multiTypeOptions = {
|
|
462
474
|
'::type': 'xxx-of-option'
|
|
463
475
|
};
|
|
@@ -467,23 +479,18 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
467
479
|
if (v === 'null') {
|
|
468
480
|
multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';
|
|
469
481
|
} else if ('integer, number, string, boolean,'.includes(`${v},`)) {
|
|
470
|
-
|
|
471
|
-
const primitiveTypeInfo = getTypeInfo(subSchema, options);
|
|
482
|
+
const primitiveTypeInfo = asPrimitiveOption(Array.isArray(v) ? v.join('┃') : v);
|
|
472
483
|
multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;
|
|
473
484
|
} else if (v === 'object') {
|
|
474
485
|
// If object type iterate all the properties and create an object-type-option
|
|
475
486
|
const objTypeOption = {
|
|
476
|
-
'::title': schema.title || '',
|
|
477
|
-
'::description': schema.description || '',
|
|
478
487
|
'::flags': {
|
|
479
488
|
'🆁': schema.readOnly && '🆁',
|
|
480
489
|
'🆆': schema.writeOnly && '🆆'
|
|
481
490
|
},
|
|
482
491
|
'::link': schema.title || '',
|
|
483
492
|
'::circular': !!schema.circularReference,
|
|
484
|
-
'::type': 'object'
|
|
485
|
-
'::deprecated': schema.deprecated || false,
|
|
486
|
-
'::metadata': metadata
|
|
493
|
+
'::type': 'object'
|
|
487
494
|
};
|
|
488
495
|
for (const key in schemaProperties) {
|
|
489
496
|
var _schema$required;
|
|
@@ -493,14 +500,16 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
493
500
|
objTypeOption[key] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
|
|
494
501
|
}
|
|
495
502
|
}
|
|
503
|
+
for (const key in schemaPatternProperties) {
|
|
504
|
+
objTypeOption[`<pattern: ${key}>`] = schemaInObjectNotation(schemaPatternProperties[key], options, level + 1);
|
|
505
|
+
}
|
|
496
506
|
if (schema.additionalProperties) {
|
|
497
507
|
objTypeOption['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, options);
|
|
498
508
|
}
|
|
499
509
|
multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;
|
|
500
510
|
} else if (v === 'array') {
|
|
501
511
|
multiTypeOptions[`::OPTION~${i + 1}`] = {
|
|
502
|
-
'::
|
|
503
|
-
'::description': schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
|
|
512
|
+
'::description': (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
|
|
504
513
|
'::flags': {
|
|
505
514
|
'🆁': schema.readOnly && '🆁',
|
|
506
515
|
'🆆': schema.writeOnly && '🆆'
|
|
@@ -509,10 +518,11 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
509
518
|
'::circular': !!schema.circularReference,
|
|
510
519
|
'::type': 'array',
|
|
511
520
|
// Array properties are read from the ::props object instead of reading from the keys of this object
|
|
512
|
-
'::props': schemaInObjectNotation(Object.assign({}, schema,
|
|
513
|
-
|
|
521
|
+
'::props': schemaInObjectNotation(Object.assign({}, schema, {
|
|
522
|
+
deprecated: undefined
|
|
523
|
+
}, arrayItemsSchema, {
|
|
524
|
+
description: arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description
|
|
514
525
|
}), options, level + 1),
|
|
515
|
-
'::deprecated': schema.deprecated || false,
|
|
516
526
|
'::metadata': metadata
|
|
517
527
|
};
|
|
518
528
|
}
|
|
@@ -522,7 +532,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
|
|
|
522
532
|
}
|
|
523
533
|
return obj;
|
|
524
534
|
}
|
|
525
|
-
if (propertyType === 'object' || schemaProperties || schema.circularReference) {
|
|
535
|
+
if (propertyType === 'object' || schemaProperties || schemaPatternProperties || schema.circularReference) {
|
|
526
536
|
const obj = {
|
|
527
537
|
'::type': ''
|
|
528
538
|
};
|
|
@@ -68,7 +68,7 @@ function getTypeInfo(parameter, options = {
|
|
|
68
68
|
info.default = arrayItemDefault;
|
|
69
69
|
info.allowedValues = typeof schema.const !== 'undefined' && [schema.const] || schema.items.enum || null;
|
|
70
70
|
}
|
|
71
|
-
if (schema.uniqueItems) {
|
|
71
|
+
if (schema.uniqueItems && dataType.match(/array|\[\]/)) {
|
|
72
72
|
info.constraints.push('Requires unique items');
|
|
73
73
|
}
|
|
74
74
|
if (dataType.match(/integer|number/g)) {
|
|
@@ -369,7 +369,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
369
369
|
// If allOf is an array of multiple elements, then all the keys makes a single object
|
|
370
370
|
const objWithAllProps = {};
|
|
371
371
|
allOf.map((v, i) => {
|
|
372
|
-
if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
|
372
|
+
if (v.type === 'object' || v.properties || v.patternProperties || v.allOf || v.anyOf || v.oneOf) {
|
|
373
373
|
const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';
|
|
374
374
|
const partialObj = schemaInObjectNotation(v, options, level + 1, propSuffix);
|
|
375
375
|
Object.assign(objWithAllProps, partialObj);
|
|
@@ -395,7 +395,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
395
395
|
let writeOnly = true;
|
|
396
396
|
let readOnly = true;
|
|
397
397
|
(anyOf || oneOf || []).forEach((v, index) => {
|
|
398
|
-
if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf || v.type === 'array' || v.items) {
|
|
398
|
+
if (v.type === 'object' || v.properties || v.patternProperties || v.allOf || v.anyOf || v.oneOf || v.type === 'array' || v.items) {
|
|
399
399
|
const partialObj = schemaInObjectNotation(v, options);
|
|
400
400
|
if (partialObj) {
|
|
401
401
|
var _partialObj$Flags, _partialObj$Flags2;
|
|
@@ -428,6 +428,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
428
428
|
};
|
|
429
429
|
resultObj['::title'] = schema.title || '';
|
|
430
430
|
resultObj['::description'] = schema.description || '';
|
|
431
|
+
resultObj['::deprecated'] = schema.deprecated || false;
|
|
431
432
|
resultObj['::metadata'] = metadata;
|
|
432
433
|
return resultObj;
|
|
433
434
|
}
|
|
@@ -454,19 +455,30 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
454
455
|
complexTypes.push(v);
|
|
455
456
|
}
|
|
456
457
|
});
|
|
458
|
+
// Rendered as one option of several: title, description and deprecation belong to the property itself
|
|
459
|
+
const asPrimitiveOption = type => getTypeInfo({
|
|
460
|
+
...subSchema,
|
|
461
|
+
type,
|
|
462
|
+
title: undefined,
|
|
463
|
+
description: undefined,
|
|
464
|
+
deprecated: undefined
|
|
465
|
+
}, options);
|
|
457
466
|
let multiPrimitiveTypes;
|
|
458
467
|
if (primitiveType.length > 0) {
|
|
459
468
|
subSchema.type = primitiveType.join('┃');
|
|
460
|
-
multiPrimitiveTypes = getTypeInfo(subSchema, options);
|
|
461
469
|
if (complexTypes.length === 0) {
|
|
462
|
-
var
|
|
463
|
-
return `${((
|
|
470
|
+
var _getTypeInfo;
|
|
471
|
+
return `${((_getTypeInfo = getTypeInfo(subSchema, options)) === null || _getTypeInfo === void 0 ? void 0 : _getTypeInfo.html) || ''}`;
|
|
464
472
|
}
|
|
473
|
+
multiPrimitiveTypes = asPrimitiveOption(subSchema.type);
|
|
465
474
|
}
|
|
466
475
|
if (complexTypes.length > 0) {
|
|
467
476
|
obj['::link'] = schema.title || '';
|
|
468
477
|
obj['::circular'] = !!schema.circularReference;
|
|
469
478
|
obj['::type'] = 'object';
|
|
479
|
+
obj['::title'] = schema.title || '';
|
|
480
|
+
obj['::description'] = schema.description || '';
|
|
481
|
+
obj['::deprecated'] = schema.deprecated || false;
|
|
470
482
|
const multiTypeOptions = {
|
|
471
483
|
'::type': 'xxx-of-option'
|
|
472
484
|
};
|
|
@@ -476,23 +488,18 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
476
488
|
if (v === 'null') {
|
|
477
489
|
multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';
|
|
478
490
|
} else if ('integer, number, string, boolean,'.includes(`${v},`)) {
|
|
479
|
-
|
|
480
|
-
const primitiveTypeInfo = getTypeInfo(subSchema, options);
|
|
491
|
+
const primitiveTypeInfo = asPrimitiveOption(Array.isArray(v) ? v.join('┃') : v);
|
|
481
492
|
multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;
|
|
482
493
|
} else if (v === 'object') {
|
|
483
494
|
// If object type iterate all the properties and create an object-type-option
|
|
484
495
|
const objTypeOption = {
|
|
485
|
-
'::title': schema.title || '',
|
|
486
|
-
'::description': schema.description || '',
|
|
487
496
|
'::flags': {
|
|
488
497
|
'🆁': schema.readOnly && '🆁',
|
|
489
498
|
'🆆': schema.writeOnly && '🆆'
|
|
490
499
|
},
|
|
491
500
|
'::link': schema.title || '',
|
|
492
501
|
'::circular': !!schema.circularReference,
|
|
493
|
-
'::type': 'object'
|
|
494
|
-
'::deprecated': schema.deprecated || false,
|
|
495
|
-
'::metadata': metadata
|
|
502
|
+
'::type': 'object'
|
|
496
503
|
};
|
|
497
504
|
for (const key in schemaProperties) {
|
|
498
505
|
var _schema$required;
|
|
@@ -502,14 +509,16 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
502
509
|
objTypeOption[key] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
|
|
503
510
|
}
|
|
504
511
|
}
|
|
512
|
+
for (const key in schemaPatternProperties) {
|
|
513
|
+
objTypeOption[`<pattern: ${key}>`] = schemaInObjectNotation(schemaPatternProperties[key], options, level + 1);
|
|
514
|
+
}
|
|
505
515
|
if (schema.additionalProperties) {
|
|
506
516
|
objTypeOption['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, options);
|
|
507
517
|
}
|
|
508
518
|
multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;
|
|
509
519
|
} else if (v === 'array') {
|
|
510
520
|
multiTypeOptions[`::OPTION~${i + 1}`] = {
|
|
511
|
-
'::
|
|
512
|
-
'::description': schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
|
|
521
|
+
'::description': (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
|
|
513
522
|
'::flags': {
|
|
514
523
|
'🆁': schema.readOnly && '🆁',
|
|
515
524
|
'🆆': schema.writeOnly && '🆆'
|
|
@@ -518,10 +527,11 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
518
527
|
'::circular': !!schema.circularReference,
|
|
519
528
|
'::type': 'array',
|
|
520
529
|
// Array properties are read from the ::props object instead of reading from the keys of this object
|
|
521
|
-
'::props': schemaInObjectNotation(Object.assign({}, schema,
|
|
522
|
-
|
|
530
|
+
'::props': schemaInObjectNotation(Object.assign({}, schema, {
|
|
531
|
+
deprecated: undefined
|
|
532
|
+
}, arrayItemsSchema, {
|
|
533
|
+
description: arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description
|
|
523
534
|
}), options, level + 1),
|
|
524
|
-
'::deprecated': schema.deprecated || false,
|
|
525
535
|
'::metadata': metadata
|
|
526
536
|
};
|
|
527
537
|
}
|
|
@@ -531,7 +541,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
531
541
|
}
|
|
532
542
|
return obj;
|
|
533
543
|
}
|
|
534
|
-
if (propertyType === 'object' || schemaProperties || schema.circularReference) {
|
|
544
|
+
if (propertyType === 'object' || schemaProperties || schemaPatternProperties || schema.circularReference) {
|
|
535
545
|
const obj = {
|
|
536
546
|
'::type': ''
|
|
537
547
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.836",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Authress Developers <developers@authress.io>",
|
|
6
6
|
"type": "module",
|