microsoft / microsoft/fhir-server
Narrative HTML validation ignores some errors
- Dominant language
- TSQL
- Stars
- 1.4k
- Forks
- 592
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 41
Description
**Describe the bug**
The HTML validation of a resource narrative can ignore errors that should be raised.
If the narrative contains html errors that should be ignored the validation function exits without completing the rest of the validation which may find additional errors that shouldn't be ignored.
**FHIR Version?**
Core
**Data provider?**
N/A
**To Reproduce**
Steps to reproduce the behavior:
1. Create a FHIR resource (i.e. Patient) with a text narrative containing html errors that can be ignored by the narrative html validator as well as html errors that cannot be ignored:
```
{
"resourceType": "Patient",
"id": "example",
"text": {
"status": "generated",
"div": "
},
"name": [
{
"family": "Windsor",
"given": [
"Peter",
"James"
]
}
]
}
```
2. Create the resource POST {{fhirurl}}/Patient
**Expected behavior**
400 Bad Request response for "Illegal element name 'NOT_VALID_TAG'."
**Actual behavior**
201 Created response
[AB#101209](https://microsofthealth.visualstudio.com/f8da5110-49b1-4e9f-9022-2f58b6124ff9/_workitems/edit/101209)
Contributor guide
Research direction
Reproduce the issue by POSTing the provided Patient resource to the FHIR /Patient endpoint and trace the narrative HTML validation path. Confirm that an ignorable HTML error does not prevent detection of the illegal element name, and verify that the request returns 400 Bad Request rather than 201 Created.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100