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

Parameters resource validation not applying invariants to part element #399

Open
cames-be opened this issue Dec 9, 2024 · 0 comments
Open

Comments

@cames-be
Copy link

cames-be commented Dec 9, 2024

Describe the bug
Parameters.parameter.part is a contentReference that should inherit the constraints from Parameters.parameter. The validators are not applying the invariant when an invalid Parameters resource is used. Using the following example Parameters resource

{
	"resourceType": "Parameters",
	"parameter": [
		{
			"name": "temp-name",
			"part": [
				{
					"name": "invalid"
				}
			]
		}
	]
}

The lack of Parameters.parameter[0].part[0].value element should result in an OperationOutcome with an error issue but instead it returns an OperationOutcome with no issues. Using the legacy validators correctly returns an OperationOutcome:

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "invariant",
      "details": {
        "coding": [
          {
            "system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
            "code": "1012"
          },
          {
            "system": "http://hl7.org/fhir/StructureDefinition/Parameters",
            "code": "inv-1",
            "display": "A parameter must have one and only one of (value, resource, part)"
          }
        ],
        "text": "Instance failed constraint inv-1 \"A parameter must have one and only one of (value, resource, part)\""
      },
      "diagnostics": "(part.exists() and value.empty() and resource.empty()) or (part.empty() and (value.exists() xor resource.exists()))",
      "location": [
        "Parameters.parameter[0].part[0]"
      ],
      "expression": [
        "Parameters.parameter[0].part[0]"
      ]
    }
  ]
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/cames-be/firely-validator-api-parameters-issue
  2. Run the unit tests in both projects
  3. The unit test in the firely-validator-api-legacy project generates an OperationOutcome with the correct issue
  4. The unit test in the firely-validator-api-current project generates an empty OperationOutcome with no issues

Expected behavior
The validator should create an OperationOutcome with an issue for the Parameters invariant inv-1 https://hl7.org/fhir/R4/parameters.html#invs

Version used:

  • FHIR Version: R4
  • Firely.FHIR.Validation Version: 2.6.1
  • Hl7.Fhir.R4 version 5.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant