Skip to content

Conversation

dotasek
Copy link
Collaborator

@dotasek dotasek commented Sep 5, 2025

This refactors some of the code used to generate ValidationEngine instances for tasks in the CLI and in the validator-wrapper project.

Its primary purpose is to move ValidationContext processing code into fewer places to enable replacement with more modular POJOs. Before ValidationContext is completely removed, methods can be put in these places to derive those modular POJOs to ensure backward compatibility.

Refactor the ValidationService to move most instantiations from ValidationContext into one place.
@dotasek
Copy link
Collaborator Author

dotasek commented Sep 8, 2025

Including this question from @grahamegrieve so we can track design decisions.

do we use any of the deprecated methods?

Yes. ValidationContext is used to pass params from the CLI and from validator-wrapper. These should be maintained to give downstream projects like matchbox and Inferno (@oliveregger, Inferno Contact?) a period to adjust.

The intent here is to eventually get rid of them and replace them in the following manner:

//Old way
ValidatorEngine engine = validationService.initializeValidator(validationContext, definitions, timetracker);

// Note that there's no option to change things like hintAboutNonMustSupport, anyExtensionsAllowed, etc. as these are pulled from the engine.
InstanceValidator instanceValidator = getValidator(FhirFormat.JSON);
//New way. Note that definitions is gone because of the changes in the PR, which automatically build it from validationEngineSettings.

ValidatorEngine engine = validationServive.buildEngine(validationEngineSettings, TimeTracker tt)

// Now we have a validationEngineSettings, which can be used to set hintAboutNonMustSupport, anyExtensionsAllowed, etc. So now an existing ValidationEngine has fewer reasons to change and is easier to re-use by things like server mode.
InstanceValidator instanceValidator = getValidator(validationInstanceSettings, FhirFormat.JSON);

What I was envisioning for backwards compatibility is that validationEngineSettings would contain a default validationInstanceSettings so that getValidator(FhirFormat.JSON) could just use that.

Copy link

codecov bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 13.34%. Comparing base (630bc69) to head (73c87c5).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2162      +/-   ##
============================================
- Coverage     13.35%   13.34%   -0.01%     
+ Complexity    37077    37061      -16     
============================================
  Files          2459     2459              
  Lines        724940   724941       +1     
  Branches     211969   211966       -3     
============================================
- Hits          96833    96764      -69     
- Misses       594960   595049      +89     
+ Partials      33147    33128      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant