fix(schema): harden realm-safe JSON validation

This commit is contained in:
Tianyi Cui
2026-07-21 22:11:41 +08:00
parent acc628f3af
commit 384cc8c157
6 changed files with 46 additions and 4 deletions
+1 -1
View File
@@ -351,7 +351,7 @@ function checkValueUnchecked(node: JsonSchemaNode, value: unknown, path: string)
return safelyIsJsonValue(value) ? [] : [`"${diagnosticPath(path)}" must be a lossless JSON object`]
}
case 'array': {
if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype) return [`"${diagnosticPath(path)}" must be an array`]
if (!Array.isArray(value)) return [`"${diagnosticPath(path)}" must be an array`]
const items = node.items
const violations = items === undefined
? []