Skip to content

Do not hide diagnostics in RepositoryValidatingInterceptor #7070

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MartinBernstorff
Copy link

@MartinBernstorff MartinBernstorff commented Jun 19, 2025

Currently, the RepositoryValidatingInterceptor outputs only the first issue, whether or not that is the issue that triggers the operation to fail validation. E.g. if the first issue is INFO, the user will not be informed why the validation failed.

This is a simple improvement that outputs diagnostics for all issues. This does change default behaviour, so we could feature-flag it.

Ideally, I think we'd:

  • Sort the issues by severity
  • Output SEVERITY: Diagnostics

But I am not certain whether this information is available from the IBaseOperationOutcome, because the code in OperationOutcomeUtil.getIssueStringPart is quite reflexive :-)

Tests

  • Tried unit testing by parsing JSON from a real example. However, we cannot initialise a FhirContext in hapi-fhir-base, because it does not include any FHIR structure JARs.
  • I ended up with static mocking instead. Note that all new code in OperationOutcomeUtil is covered by the test.

@MartinBernstorff MartinBernstorff changed the title Do not swallow errors Do not swallow errors in RepositoryValidatingInterceptor Jun 19, 2025
@MartinBernstorff MartinBernstorff changed the title Do not swallow errors in RepositoryValidatingInterceptor Do not swallow errors in RepositoryValidatingInterceptor Jun 19, 2025
@MartinBernstorff MartinBernstorff changed the title Do not swallow errors in RepositoryValidatingInterceptor Do not hide diagnostics in RepositoryValidatingInterceptor Jun 19, 2025
@jamesagnew
Copy link
Collaborator

This is a good idea. Would you mind to add a test of the new behaviour? Presumably RepositoryValidatingInterceptorR4Test would be a good place for it.

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.

2 participants