openapi-explorer 2.2.719 → 2.2.720

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.
@@ -102,7 +102,8 @@ export function getTypeInfo(parameter, options = {
102
102
  export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
103
103
  var _Object$values$0$valu, _Object$values$, _schemaObj$type;
104
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;
105
- if (skipExampleIds && typeof example === 'string' && fallbackPropertyName.match(/id$/i)) {
105
+ const propertyName = fallbackPropertyName || 'string';
106
+ if (skipExampleIds && typeof example === 'string' && propertyName.match(/id$/i)) {
106
107
  return '';
107
108
  }
108
109
  if (typeof example !== 'undefined') {
@@ -137,16 +138,16 @@ export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampl
137
138
  if (typeValue.match(/^null/g)) {
138
139
  return null;
139
140
  }
140
- if (skipExampleIds && typeValue.match(/^string/g) && fallbackPropertyName.match(/id$/i)) {
141
+ if (skipExampleIds && typeValue.match(/^string/g) && propertyName.match(/id$/i)) {
141
142
  return '';
142
143
  }
143
144
  if (typeValue.match(/^string/g)) {
144
145
  if (schemaObj.pattern) {
145
146
  const examplePattern = schemaObj.pattern.replace(/[+*](?![^\][]*[\]])/g, '{8}').replace(/\{\d*,(\d+)?\}/g, '{8}');
146
147
  try {
147
- return new RandExp(examplePattern).gen() || fallbackPropertyName || 'string';
148
+ return new RandExp(examplePattern).gen() || propertyName;
148
149
  } catch (error) {
149
- return fallbackPropertyName || 'string';
150
+ return propertyName;
150
151
  }
151
152
  }
152
153
  if (schemaObj.format) {
@@ -183,7 +184,7 @@ export function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampl
183
184
  return schemaObj.format;
184
185
  }
185
186
  } else {
186
- return fallbackPropertyName || 'string';
187
+ return propertyName;
187
188
  }
188
189
  }
189
190
  // If type cannot be determined
@@ -111,7 +111,8 @@ function getTypeInfo(parameter, options = {
111
111
  function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
112
112
  var _Object$values$0$valu, _Object$values$, _schemaObj$type;
113
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;
114
- if (skipExampleIds && typeof example === 'string' && fallbackPropertyName.match(/id$/i)) {
114
+ const propertyName = fallbackPropertyName || 'string';
115
+ if (skipExampleIds && typeof example === 'string' && propertyName.match(/id$/i)) {
115
116
  return '';
116
117
  }
117
118
  if (typeof example !== 'undefined') {
@@ -146,16 +147,16 @@ function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
146
147
  if (typeValue.match(/^null/g)) {
147
148
  return null;
148
149
  }
149
- if (skipExampleIds && typeValue.match(/^string/g) && fallbackPropertyName.match(/id$/i)) {
150
+ if (skipExampleIds && typeValue.match(/^string/g) && propertyName.match(/id$/i)) {
150
151
  return '';
151
152
  }
152
153
  if (typeValue.match(/^string/g)) {
153
154
  if (schemaObj.pattern) {
154
155
  const examplePattern = schemaObj.pattern.replace(/[+*](?![^\][]*[\]])/g, '{8}').replace(/\{\d*,(\d+)?\}/g, '{8}');
155
156
  try {
156
- return new _randexp.default(examplePattern).gen() || fallbackPropertyName || 'string';
157
+ return new _randexp.default(examplePattern).gen() || propertyName;
157
158
  } catch (error) {
158
- return fallbackPropertyName || 'string';
159
+ return propertyName;
159
160
  }
160
161
  }
161
162
  if (schemaObj.format) {
@@ -192,7 +193,7 @@ function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
192
193
  return schemaObj.format;
193
194
  }
194
195
  } else {
195
- return fallbackPropertyName || 'string';
196
+ return propertyName;
196
197
  }
197
198
  }
198
199
  // If type cannot be determined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.719",
3
+ "version": "2.2.720",
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",