Refactor resource routing to use fhirType() and improve tests#1035
Open
jkiddo wants to merge 3 commits into
Open
Refactor resource routing to use fhirType() and improve tests#1035jkiddo wants to merge 3 commits into
jkiddo wants to merge 3 commits into
Conversation
…ng by fhirType() instead of parsing the URL for the resource type name
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.
This pull request refactors and enhances the
ProcessDefinitionclass in the PlanDefinition apply logic, focusing on more robust resource resolution, improved error handling, and simplifying code paths for applying definitions. The changes also update the associated unit tests to cover new behaviors and edge cases.Resource resolution improvements:
resolveCanonicalByTypethat searches for a canonical reference across all supported definition types (PlanDefinition,ActivityDefinition,Questionnaire) in parallel, using a transaction bundle. This removes the need to infer resource type from the canonical URL and ensures more reliable and unambiguous resolution.resolveResourceNamemethod, replacing type inference with actual resource inspection and search. [1] [2]SUPPORTED_DEFINITION_TYPESto define which resource types are considered for canonical resolution.Error handling and code simplification:
applyActivityDefinitionandapplyNestedPlanDefinitionto separate resource resolution from application logic, improving clarity and error reporting. The error messages now reference the actual resource ID. [1] [2] [3] [4]Testing enhancements:
ProcessDefinitionTeststo cover new resolution logic, exception handling, and edge cases, including the use of Mockito to simulate exceptions and resource returns. [1] [2] [3] [4]These changes make the PlanDefinition apply logic more robust, maintainable, and easier to extend for additional definition types or FHIR versions.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]