private IEnumerable <ValidationFailure> ValidateResource(ITypedElement typedElement) { EnsureArg.IsNotNull(typedElement, nameof(typedElement)); var xhtml = typedElement.Scalar(KnownFhirPaths.ResourceNarrative) as string; if (string.IsNullOrEmpty(xhtml)) { yield break; } var errors = _narrativeHtmlSanitizer.Validate(xhtml); var fullFhirPath = typedElement.InstanceType + "." + KnownFhirPaths.ResourceNarrative; foreach (var error in errors) { yield return(new FhirValidationFailure( fullFhirPath, error, new OperationOutcomeIssue( OperationOutcomeConstants.IssueType.Structure, OperationOutcomeConstants.IssueSeverity.Error, error, location: new[] { fullFhirPath }))); } }
private IEnumerable <ValidationFailure> ValidateResource(DomainResource domainResource) { EnsureArg.IsNotNull(domainResource, nameof(domainResource)); if (string.IsNullOrEmpty(domainResource.Text?.Div)) { yield break; } var errors = _narrativeHtmlSanitizer.Validate(domainResource.Text.Div); string propertyName = $"{domainResource.TypeName}.Text.Div"; foreach (var error in errors) { yield return(new FhirValidationFailure( propertyName, error, new OperationOutcome.IssueComponent { Code = OperationOutcome.IssueType.Structure, Severity = OperationOutcome.IssueSeverity.Error, Details = new CodeableConcept { Text = error, }, Location = new[] { propertyName }, })); } }
private IEnumerable <ValidationFailure> ValidateResource(DomainResource domainResource) { EnsureArg.IsNotNull(domainResource, nameof(domainResource)); if (string.IsNullOrEmpty(domainResource.Text?.Div)) { yield break; } var errors = _narrativeHtmlSanitizer.Validate(domainResource.Text.Div); string propertyName = $"{domainResource.TypeName}.Text.Div"; foreach (var error in errors) { yield return(new FhirValidationFailure( propertyName, error, new OperationOutcomeIssue( OperationOutcomeConstants.IssueType.Structure, OperationOutcomeConstants.IssueSeverity.Error, error, location: new[] { propertyName }))); } }