From 616d10c33f410aa278d2d20156fa650184a83619 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sat, 29 Mar 2025 20:51:34 +0100 Subject: [PATCH] Check statement format against property definition format Extraction into StatementValidator looks good --- Neo/neojs/src/domain/SubjectValidator.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Neo/neojs/src/domain/SubjectValidator.ts b/Neo/neojs/src/domain/SubjectValidator.ts index 174eb22c..17cd0ab0 100644 --- a/Neo/neojs/src/domain/SubjectValidator.ts +++ b/Neo/neojs/src/domain/SubjectValidator.ts @@ -28,11 +28,17 @@ export class SubjectValidator { return true; // Statements for unknown properties are considered valid } + const property = schema.getPropertyDefinitions().get( statement.propertyName ); + + if ( property.format !== statement.format ) { + return false; // Values in the wrong format are considered invalid + } + const errors = this.getValueFormat( statement ) - .validate( + .validate( // TODO: maybe we need to verify the statement value matches the statement format statement.value, - schema.getPropertyDefinitions().get( statement.propertyName ) + property ); return errors.length === 0;