openapi-explorer 2.2.730 → 2.2.732

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.
@@ -100,15 +100,8 @@ export function getTypeInfo(parameter, options = {
100
100
  return info;
101
101
  }
102
102
  export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
103
- var _Object$values$0$valu, _Object$values$, _schemaObj$type;
104
- const example = Array.isArray(schemaObj.examples) ? schemaObj.examples[0] : (_Object$values$0$valu = (_Object$values$ = Object.values(schemaObj.examples || {})[0]) === null || _Object$values$ === void 0 ? void 0 : _Object$values$.value) !== null && _Object$values$0$valu !== void 0 ? _Object$values$0$valu : schemaObj.example;
103
+ var _schemaObj$type;
105
104
  const propertyName = fallbackPropertyName || 'string';
106
- if (skipExampleIds && typeof example === 'string' && propertyName.match(/id$/i)) {
107
- return '';
108
- }
109
- if (typeof example !== 'undefined') {
110
- return example;
111
- }
112
105
  if (schemaObj.default) {
113
106
  return schemaObj.default;
114
107
  }
@@ -259,6 +252,13 @@ function getExampleValuesFromSchemaRecursive(rawSchema, config = {}) {
259
252
  return getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes, xmlTagProperties, overridePropertyName);
260
253
  }
261
254
  function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes, xmlTagProperties, overridePropertyName) {
255
+ const examples = Array.isArray(schema.examples) && schema.examples || schema.examples && typeof schema.examples === 'object' && Object.values(schema.examples).map(e => e.value).filter(v => v) || schema.example && [schema.example] || [];
256
+ if (config.skipExampleIds && config.propertyName && config.propertyName.match(/id$/i)) {
257
+ return [''];
258
+ }
259
+ if (examples.length) {
260
+ return examples;
261
+ }
262
262
  if (schema.type === 'array' || schema.items) {
263
263
  if (!config.xml) {
264
264
  return [getExampleValuesFromSchemaRecursive(schema.items || {}, config)];
@@ -109,15 +109,8 @@ function getTypeInfo(parameter, options = {
109
109
  return info;
110
110
  }
111
111
  function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
112
- var _Object$values$0$valu, _Object$values$, _schemaObj$type;
113
- const example = Array.isArray(schemaObj.examples) ? schemaObj.examples[0] : (_Object$values$0$valu = (_Object$values$ = Object.values(schemaObj.examples || {})[0]) === null || _Object$values$ === void 0 ? void 0 : _Object$values$.value) !== null && _Object$values$0$valu !== void 0 ? _Object$values$0$valu : schemaObj.example;
112
+ var _schemaObj$type;
114
113
  const propertyName = fallbackPropertyName || 'string';
115
- if (skipExampleIds && typeof example === 'string' && propertyName.match(/id$/i)) {
116
- return '';
117
- }
118
- if (typeof example !== 'undefined') {
119
- return example;
120
- }
121
114
  if (schemaObj.default) {
122
115
  return schemaObj.default;
123
116
  }
@@ -268,6 +261,13 @@ function getExampleValuesFromSchemaRecursive(rawSchema, config = {}) {
268
261
  return getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes, xmlTagProperties, overridePropertyName);
269
262
  }
270
263
  function getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes, xmlTagProperties, overridePropertyName) {
264
+ const examples = Array.isArray(schema.examples) && schema.examples || schema.examples && typeof schema.examples === 'object' && Object.values(schema.examples).map(e => e.value).filter(v => v) || schema.example && [schema.example] || [];
265
+ if (config.skipExampleIds && config.propertyName && config.propertyName.match(/id$/i)) {
266
+ return [''];
267
+ }
268
+ if (examples.length) {
269
+ return examples;
270
+ }
271
271
  if (schema.type === 'array' || schema.items) {
272
272
  if (!config.xml) {
273
273
  return [getExampleValuesFromSchemaRecursive(schema.items || {}, config)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.730",
3
+ "version": "2.2.732",
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",