openapi-explorer 2.2.730 → 2.2.733
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.
@@ -244,8 +244,9 @@ export default class ApiRequest extends LitElement {
|
|
244
244
|
}}"> ${v === null ? '-' : v} </a>`}`)} </div>` : ''} </td> ` : ''} </tr>`;
|
245
245
|
};
|
246
246
|
let newRows = [];
|
247
|
-
|
248
|
-
|
247
|
+
// Only Object need special handling, arrays, are just a single property still so they should fall under the regular row generator.
|
248
|
+
if (paramStyle === 'form' && paramExplode && param.schema.type === 'object') {
|
249
|
+
newRows = Object.keys(param.schema.properties || {}).map(explodedParamKey => {
|
249
250
|
var _param$schema, _param$schema$require;
|
250
251
|
const explodedParam = param.schema.properties[explodedParamKey];
|
251
252
|
const explodedParamSchema = getTypeInfo(explodedParam, {
|
@@ -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
|
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)];
|
@@ -249,8 +249,9 @@ class ApiRequest extends _lit.LitElement {
|
|
249
249
|
}}"> ${v === null ? '-' : v} </a>`}`)} </div>` : ''} </td> ` : ''} </tr>`;
|
250
250
|
};
|
251
251
|
let newRows = [];
|
252
|
-
|
253
|
-
|
252
|
+
// Only Object need special handling, arrays, are just a single property still so they should fall under the regular row generator.
|
253
|
+
if (paramStyle === 'form' && paramExplode && param.schema.type === 'object') {
|
254
|
+
newRows = Object.keys(param.schema.properties || {}).map(explodedParamKey => {
|
254
255
|
var _param$schema, _param$schema$require;
|
255
256
|
const explodedParam = param.schema.properties[explodedParamKey];
|
256
257
|
const explodedParamSchema = (0, _schemaUtils.getTypeInfo)(explodedParam, {
|
@@ -109,15 +109,8 @@ function getTypeInfo(parameter, options = {
|
|
109
109
|
return info;
|
110
110
|
}
|
111
111
|
function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleIds) {
|
112
|
-
var
|
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.
|
3
|
+
"version": "2.2.733",
|
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",
|