@@ -58,6 +58,10 @@ validation messages to the runnable.
5858
5959You can optionally skip adding validation messages by setting ` add_messages_to_runnable: false ` .
6060
61+ The ` validator_response_details ` parameter allows you to capture the detailed validator output
62+ for custom processing. Pass an empty array, and it will be populated with all validation issues.
63+ See [ Accessing Detailed Validation Results] ( #accessing-detailed-validation-results ) for more information.
64+
6165``` ruby
6266test do
6367 fhir_read(:patient , ' 123' )
@@ -81,6 +85,15 @@ test do
8185 # Validate using a particular named validator
8286 if resource_is_valid?(validator: :my_customized_validator )
8387 end
88+
89+ # Capture detailed validation results for custom processing
90+ validation_details = []
91+ unless resource_is_valid?(validator_response_details: validation_details, add_messages_to_runnable: false )
92+ # Resource is invalid, analyze the detailed error information
93+ validation_details.select { |issue | issue.severity == ' error' }.each do |issue |
94+ add_message(' error' , issue.message) if issue_of_interest?(issue)
95+ end
96+ end
8497end
8598```
8699
127140```
128141
129142## Performing Additional Validation
143+
144+ ### Custom Validation Logic
130145If you want to perform validation steps in addition to the FHIR validation,
131146you can use the ` perform_additional_validation ` method in the validator definition. The method
132147can also be used multiple times in a single validator definition to add multiple
@@ -146,6 +161,29 @@ fhir_resource_validator do
146161end
147162```
148163
164+ ### Accessing Detailed Validation Results
165+ The ` validator_response_details ` parameter provides access to the complete validation output
166+ from the validator service, including both filtered and unfiltered issues. This is useful when
167+ you need to perform custom analysis, present validation results differently, or implement
168+ conditional logic based on specific validation patterns.
169+
170+ When you pass an empty array to ` validator_response_details ` , it will be populated with validator
171+ issue objects that contain the full formatted response from the validator service. Each issue
172+ includes a ` filtered ` flag that indicates whether the issue would have been excluded by default
173+ filtering rules (such as those defined by ` exclude_message ` ).
174+
175+ #### Validator Issue Structure
176+ Each validator issue object in the ` validator_response_details ` array contains:
177+
178+ - ** ` message ` ** (String): The formatted validation message, including location information
179+ - ** ` severity ` ** (String): The severity level - ` 'error' ` , ` 'warning' ` , or ` 'info' `
180+ - ** ` location ` ** (String): The location in the resource where the issue was found
181+ - ** ` filtered ` ** (Boolean): Whether this issue would be filtered out by default exclusion rules
182+ - ** ` slice_info ` ** (Array): Nested validator issues/information (each with the same structure);
183+ typically provide details of the base-level issue, including any sub-errors or warnings
184+ - ** ` resource ` ** (FHIR::Model): The resource being validated
185+ - ** ` raw_issue ` ** (Hash): The complete raw issue hash from the validator service
186+
149187# MustSupport Test using the Evaluator
150188
151189Checking the presence of Must Support elements is a common feature across test kits and
0 commit comments