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

Added validation for the context of extensions #361

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from

Conversation

Kasdejong
Copy link
Contributor

Description

The validator should now (finally) validate extension contexts against their expected context.

Related issues

Closes #267

Tests

Added tests for all possible extension contexts

# Conflicts:
#	src/Firely.Fhir.Validation/Impl/FhirPathValidator.cs
#	test/Firely.Fhir.Validation.Compilation.Tests.Shared/FhirTestCases
@Kasdejong Kasdejong marked this pull request as draft September 18, 2024 08:22
@Kasdejong Kasdejong removed the request for review from ewoutkramer September 18, 2024 15:32
@Kasdejong
Copy link
Contributor Author

We have an issue here (Apart from the fact that I seem to have done something weird with the subrepo). We do not step into every profile we encounter. This makes sense for some cases, except it makes verifying whether we are in the correct Element a lot harder, and as a bonus, I believe omitting it is a wrong assumption.

In a separate branch, I created a Patient with a link (backboneElement) with multiple id's and, lo and behold, the validation is a success! I believe us not invoking the profile of backboneElement is a mistake here. This would require quite a big change to the validator though, but it would make my work a LOT easier. I will leave this branch for now until we have discussed this internally.

@Kasdejong Kasdejong marked this pull request as ready for review October 2, 2024 12:43
src/Firely.Fhir.Validation/Impl/FhirPathValidator.cs Outdated Show resolved Hide resolved
src/Firely.Fhir.Validation/Schema/PathStack.cs Outdated Show resolved Hide resolved
if (Contexts.Any(c => c.Type == null))
{
return new IssueAssertion(Issue.PROFILE_ELEMENTDEF_INCORRECT,
"Extension context type was not set, but a context was defined. Skipping non-invariant context validation")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we report this in the constructor? Then we can catch it before we ship the validation to the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can still validate invariants. What should we do here?

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

Successfully merging this pull request may close these issues.

New Firely validator does not complain when extension is used outside of its context
2 participants