openapi-explorer 2.2.685 → 2.2.688

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.
@@ -118,9 +118,9 @@ export default class SchemaTable extends LitElement {
118
118
  } else if (data['::type']) {
119
119
  displaySchemaLink = data['::link'];
120
120
  if (dataType === 'array') {
121
- detailObjType = data['::link'] || keyLabel.replace(/(s|Collection|List)[*]?$/i, ''); // Array of Object
121
+ detailObjType = data['::link'] || keyLabel.replace(/(s|Collection|List)[*]?$/i, '').replace(/[*]$/, ''); // Array of Object
122
122
  } else {
123
- detailObjType = data['::link'] || data['::type'];
123
+ detailObjType = (data['::link'] || data['::type']).replace(/[*]$/, '');
124
124
  }
125
125
  }
126
126
  if (typeof data === 'object') {
@@ -62,7 +62,7 @@ export function pathIsInSearch(searchVal, path) {
62
62
  const stringToSearch = `${path.method} ${path.path} ${path.summary || ''} ${path.description || ''} ${path.operationId || ''}`;
63
63
  return stringToSearch.includes(searchVal) || stringToSearch.toLowerCase().includes(searchVal) || stringToSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal) || stringToSearch.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal);
64
64
  }
65
- export function schemaKeys(schemaProps, result = new Set()) {
65
+ function schemaKeys(schemaProps, result = new Set()) {
66
66
  if (!schemaProps) {
67
67
  return result;
68
68
  }
@@ -285,7 +285,7 @@ function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes,
285
285
  if (schema.type === 'object' || schema.properties) {
286
286
  let objectExamples = [{}];
287
287
  Object.keys(schema.properties || {}).forEach(propertyName => {
288
- const innerSchema = schema.properties[propertyName];
288
+ const innerSchema = schema.properties[propertyName] || {};
289
289
  if (innerSchema.deprecated) {
290
290
  return;
291
291
  }
@@ -335,9 +335,6 @@ export function isPatternProperty(label) {
335
335
  * @param {string} suffix - used for suffixing property names to avoid duplicate props during object composition
336
336
  */
337
337
  export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
338
- if (!rawSchema) {
339
- return undefined;
340
- }
341
338
  const {
342
339
  allOf,
343
340
  oneOf,
@@ -346,7 +343,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
346
343
  properties: schemaProperties,
347
344
  patternProperties: schemaPatternProperties,
348
345
  ...schema
349
- } = rawSchema;
346
+ } = rawSchema || {};
350
347
  const propertyType = schema.type;
351
348
  const metadata = {
352
349
  constraints: []
@@ -376,7 +373,8 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
376
373
  });
377
374
  const obj = schemaInObjectNotation(schema, options, 0);
378
375
  return Object.assign({}, objWithAllProps, typeof obj === 'object' && !Array.isArray(obj) ? obj : {});
379
- } else if (anyOf || oneOf) {
376
+ }
377
+ if (anyOf || oneOf) {
380
378
  const objWithAnyOfProps = {};
381
379
  let writeOnly = true;
382
380
  let readOnly = true;
@@ -424,7 +422,8 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
424
422
  resultObj['::description'] = schema.description || '';
425
423
  resultObj['::metadata'] = metadata;
426
424
  return resultObj;
427
- } else if (Array.isArray(propertyType)) {
425
+ }
426
+ if (Array.isArray(propertyType)) {
428
427
  const obj = {
429
428
  '::type': ''
430
429
  };
@@ -516,7 +515,8 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
516
515
  obj['::ONE~OF'] = multiTypeOptions;
517
516
  }
518
517
  return obj;
519
- } else if (propertyType === 'object' || schemaProperties) {
518
+ }
519
+ if (propertyType === 'object' || schemaProperties) {
520
520
  const obj = {
521
521
  '::type': ''
522
522
  };
@@ -531,8 +531,8 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
531
531
  obj['::deprecated'] = schema.deprecated || false;
532
532
  obj['::metadata'] = metadata;
533
533
  for (const key in schemaProperties) {
534
- var _schema$required2;
535
- if (!schema.deprecated && !schemaProperties[key].deprecated && (_schema$required2 = schema.required) !== null && _schema$required2 !== void 0 && _schema$required2.includes(key)) {
534
+ var _schemaProperties$key, _schema$required2;
535
+ if (!schema.deprecated && !((_schemaProperties$key = schemaProperties[key]) !== null && _schemaProperties$key !== void 0 && _schemaProperties$key.deprecated) && (_schema$required2 = schema.required) !== null && _schema$required2 !== void 0 && _schema$required2.includes(key)) {
536
536
  obj[`${key}*`] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
537
537
  } else {
538
538
  obj[key] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
@@ -545,7 +545,8 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
545
545
  obj['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, options);
546
546
  }
547
547
  return obj;
548
- } else if (propertyType === 'array' || arrayItemsSchema) {
548
+ }
549
+ if (propertyType === 'array' || arrayItemsSchema) {
549
550
  // If Array
550
551
  const obj = {
551
552
  '::type': ''
@@ -123,9 +123,9 @@ class SchemaTable extends _lit.LitElement {
123
123
  } else if (data['::type']) {
124
124
  displaySchemaLink = data['::link'];
125
125
  if (dataType === 'array') {
126
- detailObjType = data['::link'] || keyLabel.replace(/(s|Collection|List)[*]?$/i, ''); // Array of Object
126
+ detailObjType = data['::link'] || keyLabel.replace(/(s|Collection|List)[*]?$/i, '').replace(/[*]$/, ''); // Array of Object
127
127
  } else {
128
- detailObjType = data['::link'] || data['::type'];
128
+ detailObjType = (data['::link'] || data['::type']).replace(/[*]$/, '');
129
129
  }
130
130
  }
131
131
  if (typeof data === 'object') {
@@ -10,7 +10,6 @@ exports.getCurrentElement = getCurrentElement;
10
10
  exports.invalidCharsRegEx = void 0;
11
11
  exports.pathIsInSearch = pathIsInSearch;
12
12
  exports.replaceState = replaceState;
13
- exports.schemaKeys = schemaKeys;
14
13
  exports.sleep = sleep;
15
14
  var _index = require("../languages/index.js");
16
15
  /* For Delayed Event Handler Execution */
@@ -294,7 +294,7 @@ function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes,
294
294
  if (schema.type === 'object' || schema.properties) {
295
295
  let objectExamples = [{}];
296
296
  Object.keys(schema.properties || {}).forEach(propertyName => {
297
- const innerSchema = schema.properties[propertyName];
297
+ const innerSchema = schema.properties[propertyName] || {};
298
298
  if (innerSchema.deprecated) {
299
299
  return;
300
300
  }
@@ -344,9 +344,6 @@ function isPatternProperty(label) {
344
344
  * @param {string} suffix - used for suffixing property names to avoid duplicate props during object composition
345
345
  */
346
346
  function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
347
- if (!rawSchema) {
348
- return undefined;
349
- }
350
347
  const {
351
348
  allOf,
352
349
  oneOf,
@@ -355,7 +352,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
355
352
  properties: schemaProperties,
356
353
  patternProperties: schemaPatternProperties,
357
354
  ...schema
358
- } = rawSchema;
355
+ } = rawSchema || {};
359
356
  const propertyType = schema.type;
360
357
  const metadata = {
361
358
  constraints: []
@@ -385,7 +382,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
385
382
  });
386
383
  const obj = schemaInObjectNotation(schema, options, 0);
387
384
  return Object.assign({}, objWithAllProps, typeof obj === 'object' && !Array.isArray(obj) ? obj : {});
388
- } else if (anyOf || oneOf) {
385
+ }
386
+ if (anyOf || oneOf) {
389
387
  const objWithAnyOfProps = {};
390
388
  let writeOnly = true;
391
389
  let readOnly = true;
@@ -433,7 +431,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
433
431
  resultObj['::description'] = schema.description || '';
434
432
  resultObj['::metadata'] = metadata;
435
433
  return resultObj;
436
- } else if (Array.isArray(propertyType)) {
434
+ }
435
+ if (Array.isArray(propertyType)) {
437
436
  const obj = {
438
437
  '::type': ''
439
438
  };
@@ -525,7 +524,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
525
524
  obj['::ONE~OF'] = multiTypeOptions;
526
525
  }
527
526
  return obj;
528
- } else if (propertyType === 'object' || schemaProperties) {
527
+ }
528
+ if (propertyType === 'object' || schemaProperties) {
529
529
  const obj = {
530
530
  '::type': ''
531
531
  };
@@ -540,8 +540,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
540
540
  obj['::deprecated'] = schema.deprecated || false;
541
541
  obj['::metadata'] = metadata;
542
542
  for (const key in schemaProperties) {
543
- var _schema$required2;
544
- if (!schema.deprecated && !schemaProperties[key].deprecated && (_schema$required2 = schema.required) !== null && _schema$required2 !== void 0 && _schema$required2.includes(key)) {
543
+ var _schemaProperties$key, _schema$required2;
544
+ if (!schema.deprecated && !((_schemaProperties$key = schemaProperties[key]) !== null && _schemaProperties$key !== void 0 && _schemaProperties$key.deprecated) && (_schema$required2 = schema.required) !== null && _schema$required2 !== void 0 && _schema$required2.includes(key)) {
545
545
  obj[`${key}*`] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
546
546
  } else {
547
547
  obj[key] = schemaInObjectNotation(schemaProperties[key], options, level + 1);
@@ -554,7 +554,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
554
554
  obj['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, options);
555
555
  }
556
556
  return obj;
557
- } else if (propertyType === 'array' || arrayItemsSchema) {
557
+ }
558
+ if (propertyType === 'array' || arrayItemsSchema) {
558
559
  // If Array
559
560
  const obj = {
560
561
  '::type': ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.685",
3
+ "version": "2.2.688",
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",