Skip to content

Commit d0bc1eb

Browse files
committed
arrays with primitive type should be added to the list of primitive types in schema rendring of multi types
1 parent 95698b6 commit d0bc1eb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/components/schema-tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export default class SchemaTree extends LitElement {
230230
if (readorWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {
231231
return;
232232
}
233-
const dataTypeCss = type.replace('{', '').substring(0, 4).toLowerCase();
233+
const dataTypeCss = type.replace(/^\{|^\[/g, '').substring(0, 4).toLowerCase();
234234
return html`
235235
<div class = "tr primitive">
236236
<div class="td key ${deprecated}" style='min-width:${minFieldColWidth}px' >

src/utils/schema-utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
477477
subSchema.type.forEach((v) => {
478478
if (v.match(/integer|number|string|null|boolean/g)) {
479479
primitiveType.push(v);
480+
} else if (v === 'array' && subSchema.items?.type.match(/integer|number|string|null|boolean/g)) {
481+
// Array with primitive types should also be treated as primitive type
482+
primitiveType.push(`[${subSchema.items.type}]`);
480483
} else {
481484
complexTypes.push(v);
482485
}

0 commit comments

Comments
 (0)