Skip to content

Commit 41ae645

Browse files
committed
Prevent unnecessary array explode to properties when in fact arrays should be treated as single properties. fix #269
1 parent c90cb3f commit 41ae645

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/api-request.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ export default class ApiRequest extends LitElement {
283283
};
284284

285285
let newRows = [];
286-
if (paramStyle === 'form' && paramExplode) {
287-
newRows = Object.keys(param.schema.properties).map(explodedParamKey => {
286+
// Only Object need special handling, arrays, are just a single property still so they should fall under the regular row generator.
287+
if (paramStyle === 'form' && paramExplode && param.schema.type === 'object') {
288+
newRows = Object.keys(param.schema.properties || {}).map(explodedParamKey => {
288289
const explodedParam = param.schema.properties[explodedParamKey];
289290
const explodedParamSchema = getTypeInfo(explodedParam, { includeNulls: this.includeNulls, enableExampleGeneration: true });
290291
return rowGenerator({ name: explodedParamKey, description: explodedParam.description, required: param.schema?.required?.includes(explodedParamKey) }, explodedParamSchema);

0 commit comments

Comments
 (0)