diff --git a/src/__tests__/__snapshots__/index.spec.tsx.snap b/src/__tests__/__snapshots__/index.spec.tsx.snap index e172b4be..ea9458c4 100644 --- a/src/__tests__/__snapshots__/index.spec.tsx.snap +++ b/src/__tests__/__snapshots__/index.spec.tsx.snap @@ -2658,7 +2658,11 @@ exports[`HTML Output should match tickets.schema.json 1`] = `
availableDeliveryTypes
array[string] -
+ + +
+1
+
+
@@ -2669,7 +2673,11 @@ exports[`HTML Output should match tickets.schema.json 1`] = `
ticketRecipients
array[string] -
+ + +
+1
+
+
diff --git a/src/tree/utils/walk.ts b/src/tree/utils/walk.ts index c1a80cb0..5e17369c 100644 --- a/src/tree/utils/walk.ts +++ b/src/tree/utils/walk.ts @@ -49,10 +49,24 @@ export function* processNode(node: JSONSchema4): IterableIterator { yield combinerNode; } } else if (type) { + const primaryType = getPrimaryType(node); + let validationNode: JSONSchema4 = node; + if ( + primaryType === SchemaKind.Array && + _isObject(node.items) && + !Array.isArray(node.items) && + getCombiners(node.items) === void 0 + ) { + const validationNodePrimaryType = getPrimaryType(node.items); + if (validationNodePrimaryType !== SchemaKind.Array && validationNodePrimaryType !== SchemaKind.Object) { + validationNode = node.items; + } + } + const base: IBaseNode = { id: generateId(), type: flattenTypes(type), - validations: getValidations(node), + validations: getValidations(validationNode), annotations: getAnnotations(node), ...('required' in node && { required: normalizeRequired(node.required) }), enum: node.enum,