diff --git a/backend/FwLite/MiniLcm.Tests/CreateEntryTestsBase.cs b/backend/FwLite/MiniLcm.Tests/CreateEntryTestsBase.cs index ceb32c1a2..8f937f50e 100644 --- a/backend/FwLite/MiniLcm.Tests/CreateEntryTestsBase.cs +++ b/backend/FwLite/MiniLcm.Tests/CreateEntryTestsBase.cs @@ -26,13 +26,7 @@ public async Task CanCreateEntry_AutoFaker() var createdEntry = await Api.CreateEntry(entry); createdEntry.Should().BeEquivalentTo(entry, options => options .For(e => e.Components).Exclude(e => e.Id) - .For(e => e.ComplexForms).Exclude(e => e.Id) - //predefined is always true in fwdata bridge, so we need to exclude it for now - .For(e => e.Senses).For(s => s.SemanticDomains).Exclude(s => s.Predefined) - // TODO: Figure out how to exclude just PartOfSpeech.Predefined - // .For(e => e.Senses).Exclude(s => s.PartOfSpeech.Predefined)); // rejected because PartOfSpeech could be null - // .For(e => e.Senses).Exclude(s => s.PartOfSpeech?.Predefined)); // not allowed because "An expression tree lambda may not contain a null propagating operator." - .For(e => e.Senses).Exclude(s => s.PartOfSpeech)); // Not ideal but best we can do for now + .For(e => e.ComplexForms).Exclude(e => e.Id)); } [Fact] diff --git a/backend/FwLite/MiniLcm/Validators/PartOfSpeechValidator.cs b/backend/FwLite/MiniLcm/Validators/PartOfSpeechValidator.cs index 572d894a8..476c030b2 100644 --- a/backend/FwLite/MiniLcm/Validators/PartOfSpeechValidator.cs +++ b/backend/FwLite/MiniLcm/Validators/PartOfSpeechValidator.cs @@ -7,7 +7,7 @@ public class PartOfSpeechValidator : AbstractValidator { public PartOfSpeechValidator() { - // RuleFor(pos => pos.Id).Must(BeCanonicalGuid).When(pos => pos.Predefined); // TODO: Uncomment once PR 1350 is merged + RuleFor(pos => pos.Id).Must(BeCanonicalGuid).When(pos => pos.Predefined); RuleFor(pos => pos.DeletedAt).Null(); RuleFor(pos => pos.Name).Required(); } diff --git a/backend/FwLite/MiniLcm/Validators/SenseValidator.cs b/backend/FwLite/MiniLcm/Validators/SenseValidator.cs index 34e28f713..41ac67378 100644 --- a/backend/FwLite/MiniLcm/Validators/SenseValidator.cs +++ b/backend/FwLite/MiniLcm/Validators/SenseValidator.cs @@ -10,8 +10,7 @@ public SenseValidator() RuleFor(s => s.DeletedAt).Null(); RuleFor(s => s.Definition).NoEmptyValues(); RuleFor(s => s.Gloss).NoEmptyValues(); - // RuleFor(s => s.PartOfSpeech).Empty(); // TODO: Comment out if we're not yet ready to move away from strings - // RuleFor(s => s.PartOfSpeechId).SetValidator(new IsCanonicalPartOfSpeechGuidValidator()); // Can't do this statelessly, as we'd need a full PartOfSpeech object to check if it's predefined or not + RuleFor(s => s.PartOfSpeech!).SetValidator(new PartOfSpeechValidator()).When(s => s.PartOfSpeech is not null); RuleForEach(s => s.SemanticDomains).SetValidator(new SemanticDomainValidator()); RuleForEach(s => s.ExampleSentences).SetValidator(sense => new ExampleSentenceValidator(sense)); }