fix: exclude Parameters from SyncSearchParameters (Fixes #3876)#5623
Open
rtmalikian wants to merge 1 commit into
Open
fix: exclude Parameters from SyncSearchParameters (Fixes #3876)#5623rtmalikian wants to merge 1 commit into
rtmalikian wants to merge 1 commit into
Conversation
… non-conformant CapabilityStatement The first loop in SyncSearchParameters() called ApplyToResource() for ALL resource types including Parameters, which created a resource entry in the CapabilityStatement via GetResourceComponent(). However, Parameters was never given any interactions because both PopulateDefaultResourceInteractions() and the second loop in SyncSearchParameters() skip it. This resulted in a CapabilityStatement that violated the FHIR specification's minimum cardinality constraint: CapabilityStatement.rest.resource.interaction requires at least 1 element, but the Parameters resource had 0. The fix adds the same Parameters guard to the first loop, consistent with the pattern already used in PopulateDefaultResourceInteractions(), SyncSearchParameters()'s second loop, and SyncProfilesAsync(). Fixes microsoft#5394
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5394 — The
/metadataendpoint returns aCapabilityStatementthat violates the FHIR specification's minimum cardinality constraint forCapabilityStatement.rest.resource.interaction.Root Cause
In
CapabilityStatementBuilder.SyncSearchParameters(), the first loop (line 359) calledApplyToResource()for all resource types, includingParameters. This created a resource entry in theCapabilityStatementviaGetResourceComponent(). However,Parameterswas never given any interactions because:PopulateDefaultResourceInteractions()explicitly skipsParameters(line 303-307)SyncSearchParameters()also skipsParameters(line 367-370)SyncProfilesAsync()also skipsParameters(line 391-394)The result: a
Parametersresource entry with zero interactions, violating the FHIR spec'smin = 1cardinality onCapabilityStatement.rest.resource.interaction.This caused strict FHIR parsers (e.g., Firely SDK v6.0.2+) to reject the CapabilityStatement with:
Fix
Added the same
Parametersguard to the first loop inSyncSearchParameters(), consistent with the pattern already used in three other places in the same file:PopulateDefaultResourceInteractions()(line 303-307) ✅SyncSearchParameters()second loop (line 367-370) ✅SyncProfilesAsync()(line 391-394) ✅The first loop was the only one missing this guard — it was the sole code path that could create a
Parametersresource entry without interactions.Verification
string.Equals(resource, KnownResourceTypes.Parameters, StringComparison.Ordinal)guard as the three other loops in the fileGivenAConformanceBuilder_WhenAddingDefaultInteractions_ThenParameterTypeIsNotAddedalready validates thatParametersdoesn't appear afterPopulateDefaultResourceInteractions()— the fix ensuresSyncSearchParameters()also doesn't reintroduce itImpact
After this fix, the
/metadataendpoint will return aCapabilityStatementthat conforms to the FHIR specification, and strict parsers like Firely SDK v6+ will be able to parse it without errors.About the Author: Raphael Malikian — Clinical AI Solutions Architect. I specialise in building and fixing AI/ML systems for healthcare, including vector databases, RAG pipelines, and clinical NLP. If you need help with your project or think I can add value to your organisation, feel free to reach out — I'd love to connect.
📧 rtmalikian@gmail.com
🔗 GitHub: https://github.com/rtmalikian
🔗 LinkedIn: http://www.linkedin.com/in/raphael-t-malikian-mbbs-bsc-hons-71075436a
Disclosure: This code was developed with assistance from mimo-v2.5-pro (Xiaomi) via Hermes Agent (Nous Research). All changes were reviewed, tested against the actual codebase, and verified for correctness.