From 48908579ac692ab4fccc6c1043f12d360d87c5be Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Fri, 10 Jan 2025 11:21:54 -0500 Subject: [PATCH] Add validation check for PartOfSpeechId --- backend/FwLite/MiniLcm/Validators/SenseValidator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/FwLite/MiniLcm/Validators/SenseValidator.cs b/backend/FwLite/MiniLcm/Validators/SenseValidator.cs index 41ac67378..24f5e2191 100644 --- a/backend/FwLite/MiniLcm/Validators/SenseValidator.cs +++ b/backend/FwLite/MiniLcm/Validators/SenseValidator.cs @@ -11,6 +11,7 @@ public SenseValidator() RuleFor(s => s.Definition).NoEmptyValues(); RuleFor(s => s.Gloss).NoEmptyValues(); RuleFor(s => s.PartOfSpeech!).SetValidator(new PartOfSpeechValidator()).When(s => s.PartOfSpeech is not null); + RuleFor(s => s.PartOfSpeechId).Equal(s => s.PartOfSpeech!.Id).When(s => s.PartOfSpeech is not null && s.PartOfSpeechId is not null); RuleForEach(s => s.SemanticDomains).SetValidator(new SemanticDomainValidator()); RuleForEach(s => s.ExampleSentences).SetValidator(sense => new ExampleSentenceValidator(sense)); }