public virtual OperationOutcome Validate(Validator validator, IElementNavigator errorLocation) { var outcome = new OperationOutcome(); if (!Cardinality.InRange(Members.Count)) { validator.Trace(outcome, $"Instance count for '{Name}' is {Members.Count}, which is not within the specified cardinality of {Cardinality.ToString()}", Issue.CONTENT_INCORRECT_OCCURRENCE, errorLocation); } return(outcome); }
public virtual OperationOutcome Validate(Validator validator, IElementNavigator errorLocation) { var outcome = new OperationOutcome(); if (!Cardinality.InRange(Members.Count)) { OperationOutcome.IssueComponent issue = validator.Trace(outcome, $"Instance count for '{Name}' is {Members.Count}, which is not within the specified cardinality of {Cardinality.ToString()}", Issue.CONTENT_INCORRECT_OCCURRENCE, errorLocation); if (issue != null) { // the location in the structure definition (this will match to the discriminator when checking slicing) // issue.LocationElement.Add(new FhirString(Path)); issue.SetAnnotation(new SlicePathAnnotation(Path)); } } return(outcome); }