Skip to content
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

Align Error messages from validator and parser #2580

Open
brianpos opened this issue Sep 5, 2023 · 3 comments
Open

Align Error messages from validator and parser #2580

brianpos opened this issue Sep 5, 2023 · 3 comments

Comments

@brianpos
Copy link
Collaborator

brianpos commented Sep 5, 2023

Is your feature request related to a problem? Please describe.
There are some errors that the parser is able to check that the validator also checks, these should really be aligned so that they use the same error code, and hopefully return the same location. (so they can be de-duplicated when needed)

e.g.

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "code-invalid",
            "details": {
                "coding": [
                    {
                        "system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
                        "code": "6007"
                    }
                ],
                "text": "Code 'grab' does not exist in the value set 'PublicationStatus' (http://hl7.org/fhir/ValueSet/publication-status)"
            },
            "expression": [
                "SearchParameter.status[0]"
            ]
        },
        {
            "severity": "error",
            "code": "code-invalid",
            "details": {
                "coding": [
                    {
                        "system": "http://firely.com/CodeSystem/ErrorMessages",
                        "code": "PVAL116",
                        "display": "Invalid code"
                    }
                ],
                "text": "Value 'grab' is not a correct code for valueset 'PublicationStatus'."
            },
            "diagnostics": "Value 'grab' is not a correct code for valueset 'PublicationStatus'. At SearchParameter.status, line 15, position 21",
            "expression": [
                "SearchParameter.status"
            ]
        }
    ]
}

Describe the solution you'd like
PVAL116 and 6007 are the same error, shouldn't they be the same coding?
Alternatively provide another routine to be able to cross reference the codes, and or locations. The validator looks like it doesn't use the short form of the path where it doesn't consider every item an array, and only include the positional accessors when it is a collection.

Describe alternatives you've considered
I'm contemplating writing a routine to manually do this processing.

@mmsmits
Copy link
Member

mmsmits commented May 1, 2024

We should make sure the property validator and the parser should not double errors.
Don't know how yet, but it's a good idea.

@mmsmits
Copy link
Member

mmsmits commented May 1, 2024

Maybe not run attribute validation when an element has reported a parse error.

@brianpos
Copy link
Collaborator Author

brianpos commented May 1, 2024

There is a flag on the serializer for that already.
I think it should be just changing the message that is being reported to use the same coding, and ensure that it doesn't re-add it for the same location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants