Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

setConcurrentBundleValidation(true) bypasses required profile validation (e.g., meta.lastUpdated)

31 views
Skip to first unread message

Vinod Aravind

unread,
May 13, 2025, 7:58:45 AMMay 13
to HAPI FHIR
Hi,

We are validating a FHIR Bundle against a custom StructureDefinition, which requires meta.lastUpdated at the Bundle level.
If we enable setConcurrentBundleValidation(true), validation passes even when this required element is missing.
If concurrency is disabled (default), we receive the correct validation error as expected.

This suggests that setConcurrentBundleValidation(true) may skip or misapply profile validation under certain conditions, even for a single Bundle with no actual concurrency load.

Repro Steps:

  1. Create a Bundle with a profile requiring meta.lastUpdated.

  2. Remove meta.lastUpdated from the Bundle.

  3. Validate with:

    • setConcurrentBundleValidation(true)Passes (unexpected).

    • ❌ Without it → Fails as expected.


Environment:

  • HAPI FHIR Version: [e.g., 8.0.0]

  • Java: OpenJDK 21.0.3

  • Profile: Custom

  • Validation Engine: HAPI FhirValidator with FhirInstanceValidator


Expected Behavior:
Validation should fail when required fields are missing — regardless of concurrency mode.

Actual Behavior:
Validation only fails in non-concurrent mode — concurrent validation masks errors.

Please advice.

Thanks,
Vinod A

Vinod Aravind

unread,
May 13, 2025, 8:06:04 AMMay 13
to HAPI FHIR
Here is the code I used:

FhirValidator fhirValidator = fhirContext.newValidator().registerValidatorModule(instanceValidator);

// Enable concurrent validation
fhirValidator.setConcurrentBundleValidation(true);

// Configure thread pool executor
ExecutorService executorService = Executors.newFixedThreadPool(2);
fhirValidator.setExecutorService(executorService);

return fhirValidator;


James Agnew

unread,
May 13, 2025, 8:51:35 AMMay 13
to Vinod Aravind, HAPI FHIR
This is unfortunately a known limitation of concurrent bundle validation: Only the individual entries are individually concurrently validated, the containing bundle is not.

If you need rules enforced on the outer bundle, you need to disable concurrent validation. PRs would be welcome to improve this of course, but this is how it currently works.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hapi-fhir/bc50bf8a-4a4c-4415-8863-de2027abc5f9n%40googlegroups.com.

Vinod Aravind

unread,
May 14, 2025, 6:25:03 AMMay 14
to HAPI FHIR

Thanks, James, for the clarification!

That makes sense. For now, I’ll disable concurrent validation when I need to validate the Bundle-level rules.

I truly appreciate your openness to contributions. At this point, I may not be in a position to submit a PR myself, but I’ll definitely keep it in mind for the future.

Cheers,
Vinod

Reply all
Reply to author
Forward
0 new messages