openapi-explorer 2.2.705 → 2.2.708

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.
@@ -488,7 +488,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
488
488
  } else if (v === 'array') {
489
489
  multiTypeOptions[`::OPTION~${i + 1}`] = {
490
490
  '::title': schema.title || '',
491
- '::description': schema.description || '',
491
+ '::description': schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
492
492
  '::flags': {
493
493
  '🆁': schema.readOnly && '🆁',
494
494
  '🆆': schema.writeOnly && '🆆'
@@ -496,8 +496,9 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
496
496
  '::link': arrayItemsSchema.title || schema.title || '',
497
497
  '::type': 'array',
498
498
  // Array properties are read from the ::props object instead of reading from the keys of this object
499
- // '::props': schemaInObjectNotation(Object.assign({ deprecated: schema.deprecated, readOnly: schema.readOnly, writeOnly: schema.writeOnly }, arrayItemsSchema), options, (level + 1)),
500
- '::props': schemaInObjectNotation(Object.assign({}, schema, arrayItemsSchema), options, level + 1),
499
+ '::props': schemaInObjectNotation(Object.assign({}, schema, arrayItemsSchema, {
500
+ description: schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description)
501
+ }), options, level + 1),
501
502
  '::deprecated': schema.deprecated || false,
502
503
  '::metadata': metadata
503
504
  };
@@ -544,7 +545,7 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
544
545
  '::type': ''
545
546
  };
546
547
  obj['::title'] = schema.title || '';
547
- obj['::description'] = schema.description || (arrayItemsSchema !== null && arrayItemsSchema !== void 0 && arrayItemsSchema.description ? `array<${arrayItemsSchema.description}>` : '');
548
+ obj['::description'] = schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '';
548
549
  obj['::flags'] = {
549
550
  '🆁': schema.readOnly && '🆁',
550
551
  '🆆': schema.writeOnly && '🆆'
@@ -557,7 +558,9 @@ export function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '
557
558
  // Use type: undefined to prevent schema recursion by passing array from the parent to the next loop. arrayItemsSchema should have had type defined but it doesn't.
558
559
  obj['::props'] = schemaInObjectNotation(Object.assign({}, schema, {
559
560
  type: undefined
560
- }, arrayItemsSchema), options, level + 1);
561
+ }, arrayItemsSchema, {
562
+ description: obj['::description']
563
+ }), options, level + 1);
561
564
  if (arrayItemsSchema !== null && arrayItemsSchema !== void 0 && arrayItemsSchema.items) {
562
565
  obj['::array-type'] = arrayItemsSchema.items.type;
563
566
  }
@@ -7,14 +7,22 @@ export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
7
7
  var _jsonParsedSpec$info, _jsonParsedSpec$compo;
8
8
  const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
9
9
  let jsonParsedSpec;
10
- try {
11
- jsonParsedSpec = await OpenApiResolver(specUrlOrObject);
12
- } catch (error) {
13
- // eslint-disable-next-line no-console
14
- console.error('Error parsing specification', error);
15
- throw Error(`Failed to resolve the spec: ${error.message}`);
10
+ let errorToDisplay;
11
+ for (let iteration = 0; iteration < 7; iteration++) {
12
+ try {
13
+ jsonParsedSpec = await OpenApiResolver(specUrlOrObject);
14
+ break;
15
+ } catch (error) {
16
+ // eslint-disable-next-line no-console
17
+ console.error('Error parsing specification', error);
18
+ errorToDisplay = error.message;
19
+ await new Promise(resolve => setTimeout(resolve, 100 * 2 ** iteration));
20
+ }
16
21
  }
17
22
  if (!jsonParsedSpec) {
23
+ if (errorToDisplay) {
24
+ throw Error(`Failed to resolve the spec: ${errorToDisplay}`);
25
+ }
18
26
  throw Error('SpecificationNotFound');
19
27
  }
20
28
 
@@ -497,7 +497,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
497
497
  } else if (v === 'array') {
498
498
  multiTypeOptions[`::OPTION~${i + 1}`] = {
499
499
  '::title': schema.title || '',
500
- '::description': schema.description || '',
500
+ '::description': schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '',
501
501
  '::flags': {
502
502
  '🆁': schema.readOnly && '🆁',
503
503
  '🆆': schema.writeOnly && '🆆'
@@ -505,8 +505,9 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
505
505
  '::link': arrayItemsSchema.title || schema.title || '',
506
506
  '::type': 'array',
507
507
  // Array properties are read from the ::props object instead of reading from the keys of this object
508
- // '::props': schemaInObjectNotation(Object.assign({ deprecated: schema.deprecated, readOnly: schema.readOnly, writeOnly: schema.writeOnly }, arrayItemsSchema), options, (level + 1)),
509
- '::props': schemaInObjectNotation(Object.assign({}, schema, arrayItemsSchema), options, level + 1),
508
+ '::props': schemaInObjectNotation(Object.assign({}, schema, arrayItemsSchema, {
509
+ description: schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description)
510
+ }), options, level + 1),
510
511
  '::deprecated': schema.deprecated || false,
511
512
  '::metadata': metadata
512
513
  };
@@ -553,7 +554,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
553
554
  '::type': ''
554
555
  };
555
556
  obj['::title'] = schema.title || '';
556
- obj['::description'] = schema.description || (arrayItemsSchema !== null && arrayItemsSchema !== void 0 && arrayItemsSchema.description ? `array&lt;${arrayItemsSchema.description}&gt;` : '');
557
+ obj['::description'] = schema.description || (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.description) || '';
557
558
  obj['::flags'] = {
558
559
  '🆁': schema.readOnly && '🆁',
559
560
  '🆆': schema.writeOnly && '🆆'
@@ -566,7 +567,9 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
566
567
  // Use type: undefined to prevent schema recursion by passing array from the parent to the next loop. arrayItemsSchema should have had type defined but it doesn't.
567
568
  obj['::props'] = schemaInObjectNotation(Object.assign({}, schema, {
568
569
  type: undefined
569
- }, arrayItemsSchema), options, level + 1);
570
+ }, arrayItemsSchema, {
571
+ description: obj['::description']
572
+ }), options, level + 1);
570
573
  if (arrayItemsSchema !== null && arrayItemsSchema !== void 0 && arrayItemsSchema.items) {
571
574
  obj['::array-type'] = arrayItemsSchema.items.type;
572
575
  }
@@ -13,14 +13,22 @@ async function ProcessSpec(specUrlOrObject, serverUrl = '') {
13
13
  var _jsonParsedSpec$info, _jsonParsedSpec$compo;
14
14
  const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
15
15
  let jsonParsedSpec;
16
- try {
17
- jsonParsedSpec = await (0, _openapiResolverBrowser.default)(specUrlOrObject);
18
- } catch (error) {
19
- // eslint-disable-next-line no-console
20
- console.error('Error parsing specification', error);
21
- throw Error(`Failed to resolve the spec: ${error.message}`);
16
+ let errorToDisplay;
17
+ for (let iteration = 0; iteration < 7; iteration++) {
18
+ try {
19
+ jsonParsedSpec = await (0, _openapiResolverBrowser.default)(specUrlOrObject);
20
+ break;
21
+ } catch (error) {
22
+ // eslint-disable-next-line no-console
23
+ console.error('Error parsing specification', error);
24
+ errorToDisplay = error.message;
25
+ await new Promise(resolve => setTimeout(resolve, 100 * 2 ** iteration));
26
+ }
22
27
  }
23
28
  if (!jsonParsedSpec) {
29
+ if (errorToDisplay) {
30
+ throw Error(`Failed to resolve the spec: ${errorToDisplay}`);
31
+ }
24
32
  throw Error('SpecificationNotFound');
25
33
  }
26
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.705",
3
+ "version": "2.2.708",
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",