Skip to content

Commit bd371f3

Browse files
committed
manually merging #352 as it wont recognize the changes after merging the newer PRs
1 parent 4d49363 commit bd371f3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/schema-table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default class SchemaTable extends LitElement {
162162
: html`${this.generateTree(
163163
data[key]['::type'] === 'array' ? data[key]['::props'] : data[key],
164164
data[key]['::type'],
165-
data[key]['::title'] && !isNaN(key) ? data[key]['::title'] : key,
165+
data[key]['::title'] && !Number.isNaN(key) ? data[key]['::title'] : key,
166166
data[key]['::description'],
167167
(level + 1),
168168
)}`

src/utils/schema-utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
410410
});
411411
obj = objWithAllProps;
412412
} else if (schema.anyOf || schema.oneOf) {
413+
obj['::description'] = schema.description ? schema.description : '';
413414
// 1. First iterate the regular properties
414415
if (schema.type === 'object' || schema.properties) {
415416
obj['::description'] = schema.description ? schema.description : '';
@@ -456,7 +457,11 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
456457
obj['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, {});
457458
}
458459
} else if (schema.items) { // If Array
459-
obj['::description'] = schema.description ? schema.description : '';
460+
obj['::description'] = schema.description
461+
? schema.description
462+
: (schema.items.description
463+
? `array&lt;${schema.items.description}&gt;`
464+
: '');
460465
obj['::type'] = 'array';
461466
obj['::props'] = schemaInObjectNotation(schema.items, {}, (level + 1));
462467
obj['::title'] = schema.items.title ? schema.items.title : '';

0 commit comments

Comments
 (0)