@json-layout/core
Advanced tools
Comparing version 0.16.0 to 0.16.1
{ | ||
"name": "@json-layout/core", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"description": "Compilation and state management utilities for JSON Layout.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -162,3 +162,4 @@ import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout } from '@json-layout/vocabulary' | ||
const matchChildError = (error, skeleton, dataPath, parentDataPath) => { | ||
if (error.instancePath.startsWith(dataPath) && !(typeof skeleton.key === 'string' && skeleton.key.startsWith('$allOf'))) return true | ||
if (!error.schemaPath.startsWith(skeleton.pointer)) return false | ||
if (error.instancePath.startsWith(dataPath)) return true | ||
return false | ||
@@ -380,7 +381,14 @@ } | ||
const error = context.errors?.find(error => matchError(error, skeleton, dataPath, parentDataPath)) ?? context.errors?.find(error => matchChildError(error, skeleton, dataPath, parentDataPath)) | ||
let error = context.errors?.find(error => matchError(error, skeleton, dataPath, parentDataPath)) | ||
if (!error) { | ||
error = context.errors?.find(error => matchChildError(error, skeleton, dataPath, parentDataPath)) | ||
} | ||
// capture errors so that they are not repeated in parent nodes | ||
if (layout.comp !== 'none') { | ||
if (error) context.errors = context.errors?.filter(error => !matchError(error, skeleton, dataPath, parentDataPath) && !matchChildError(error, skeleton, dataPath, parentDataPath)) | ||
if (error) { | ||
context.errors = context.errors?.filter(error => { | ||
return !matchError(error, skeleton, dataPath, parentDataPath) && !matchChildError(error, skeleton, dataPath, parentDataPath) | ||
}) | ||
} | ||
} | ||
@@ -387,0 +395,0 @@ const validated = validationState.validatedForm || |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
4
89997
22
2309