-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider reporting the name of missing elements in error messages, not just in the path #2734
Comments
Spelling correction has been fixed in an earlier commit. About adding the element name: It's really hard to report the name of an element that's not there. Especially in the attribute validation that is used here. I'll discuss with the team. |
Note that you can only trigger this validation error on repeating elements with a minimum cardinality, and they are very rare in the spec. The example in |
There's a lot of information missing in this bug report, unfortunately, so I was not able to reproduce it. Assumptions:
I have tried the following XML: <ImplementationGuide xmlns="http://hl7.org/fhir">
<url value="http://example.org/fhir/ImplementationGuide/example" />
<name value="Example Implementation Guide" />
<status value="active" />
<packageId value="example-ig" />
<fhirVersion value="4.0.1" />
<definition>
<page>
<nameUrl value="bla" />
<title value="Title" />
<generation value="markdown" />
</page>
</definition>
</ImplementationGuide> Note how I have no
The path looks more complete than your example (which just says ImplementationGuilde.definition). If your example differs, or was not from R4, then I might be looking in the wrong direction. I have checked the updates since 5.3.0 and cannot find any changes to the parsers, so it is unlikely that it is caused by a recent change. Just in case, I tried this with an equivalent json example as well, and also with POCO attribute validation, all of them are providing the necessary details. |
@ewoutkramer I think this example came from a Simplifier error message, so it's definitely about the new serializers. My point here was more about the readability of the error message than that information is missing in it. Instead of putting the path at the end of the message, my personal preference would be to include it in the message. If I remember correctly the message was formatted in a way that made it appear that the path was not included. That's why I suggested to write it slightly different. Feel free to close if you prefer the current style. |
We decided not to do this. |
If the POCO-based parser reports error messages about missing mandatory elements the error message does not contain the name of the element that is missing. Example: "Element has 0 elements, but minium cardinality is 1. At ImplementationGuide.definition, line 10, position 4."
It would be more readable in the form: "Element has 0 elements, but minium cardinality for element '< elementName >' is 1. At ImplementationGuide.definition, line 10, position 4."
Also note that "minium" is spelt wrong.
The text was updated successfully, but these errors were encountered: