Skip to content

Support imposeProfile extension in validation#611

Merged
alexzautke merged 4 commits intodevelopfrom
copilot/support-impose-profile-validation
Nov 5, 2025
Merged

Support imposeProfile extension in validation#611
alexzautke merged 4 commits intodevelopfrom
copilot/support-impose-profile-validation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 31, 2025

Support ImposeProfile extension in validation

Changes made based on PR feedback:

  1. SchemaBuilder.cs: Simplified getImposeProfiles() to only handle FhirUri type since the extension must always contain valueCanonical (represented as FhirUri in the SDK)

  2. ImposeProfileTests.cs:

    • Updated extension value to use Canonical type in R4+ (with conditional compilation for STU3)
    • Added comprehensive test ValidationAgainstProfileWithImposeProfile_ValidatesImposedConstraints that:
      • Creates an imposed profile with actual constraints (requires patient name)
      • Creates a main profile that imposes this profile
      • Validates that instances without name fail (imposed constraint is enforced)
      • Validates that instances with name pass

All source projects build successfully across STU3, R4, R4B, and R5.

Original prompt

This section details on the original issue you should resolve

<issue_title>Support ImposeProfile in validation</issue_title>
<issue_description>The FHIR Extensions Package introduces the Impose Profile extension, which indicates additional profiles that a resource should be validated against: http://hl7.org/fhir/extensions/StructureDefinition-structuredefinition-imposeProfile.html

Instances can only be valid against this profile, if they also successfully validate against the profile referenced by this extension.
This is an instruction to validators to go and check the profile this extension refers to, and enforce that the instance being validated is valid against both source and target profiles. In general, the source profile won't restate the constraints in the target profile.

Please add support for this in the validator, that, when validating against a profile that has this extension, the instance is also validated against the additionally imposed profile.

Note: this is split out from the bigger SDK ticket on other 'multiple inheritance'-like solutions - #619
</issue_description>

Comments on the Issue (you are @copilot in this section)

@alexzautke Looking at the code of the Java validator, I can't currently see that this extension is being taken into account for instance validation. Only StructureDefinitions itself are validated to see if they are compatible. @wardweistra would you mind opening a Zulip discussion on this to see if Grahame has some reasons to not validate instances against the imposed profile?

Note that you can already solve this today using the SelectValidationProfiles element from the ValidationSettings of the validator.</comment_new>
<comment_new>@wardweistra
Ok, opened the discussion here: #implementers > imposeProfile validation</comment_new>
<comment_new>@wardweistra
@alexzautke Confirmed that it should#implementers > imposeProfile validation @ 💬 but may indeed not do that yet.</comment_new>
<comment_new>@wardweistra
So I guess we can start implementing this in parallel? 😇 </comment_new>
<comment_new>@alexzautke
Remember that there can be multiple imposeProfile extensions on the StructureDefinition!</comment_new>
<comment_new>@alexzautke
Add to the FS docs about validation that we support this extension</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits October 31, 2025 08:07
…rceSchema

Co-authored-by: alexzautke <548617+alexzautke@users.noreply.github.com>
Co-authored-by: alexzautke <548617+alexzautke@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for ImposeProfile in validation Support imposeProfile extension in validation Oct 31, 2025
Copilot AI requested a review from alexzautke October 31, 2025 08:15
@alexzautke
Copy link
Copy Markdown
Member

@copilot Take a look at the requested changes

…e validation test

Co-authored-by: alexzautke <548617+alexzautke@users.noreply.github.com>
@alexzautke
Copy link
Copy Markdown
Member

@Kasdejong @andrzejskowronski This looks like a promising start, maybe you can check this out?

Copy link
Copy Markdown
Member

@Kasdejong Kasdejong left a comment

Choose a reason for hiding this comment

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

this looks very good indeed. And it works? Well... that proves we did in fact write the validator in a pluggable way :))

@alexzautke alexzautke marked this pull request as ready for review November 5, 2025 10:08
@alexzautke alexzautke merged commit 98ac028 into develop Nov 5, 2025
2 checks passed
@alexzautke alexzautke deleted the copilot/support-impose-profile-validation branch November 5, 2025 10: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

Successfully merging this pull request may close these issues.

Support ImposeProfile in validation

3 participants