Module: Inferno::DSL::FHIRValidation::ClassMethods
- Defined in:
- lib/inferno/dsl/fhir_validation.rb
Instance Method Summary collapse
-
#find_validator(validator_name, selected_suite_options = nil) ⇒ Object
Find a particular validator.
- #validator(name = :default, required_suite_options: nil) ⇒ Object deprecated Deprecated.
Instance Method Details
#find_validator(validator_name, selected_suite_options = nil) ⇒ Object
Find a particular validator. Looks through a runnable’s parents up to the suite to find a validator with a particular name
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/inferno/dsl/fhir_validation.rb', line 289 def find_validator(validator_name, = nil) validators = fhir_validators[validator_name] || Array.wrap(parent&.find_validator(validator_name, )) validator = if .present? validators.find do |possible_validator| possible_validator.requirements.nil? || >= possible_validator.requirements end else validators.first end raise Exceptions::ValidatorNotFoundException, validator_name if validator.nil? validator end |
#validator(name = :default, required_suite_options: nil) ⇒ Object
Deprecated.
Define a validator
272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/inferno/dsl/fhir_validation.rb', line 272 def validator(name = :default, required_suite_options: nil, &) Inferno::Application['logger'].warn( "'validator' in '#{suite.id}' TestSuite is deprecated and will be removed in an upcoming release. " \ "Use 'fhir_resource_validator' instead." ) current_validators = fhir_validators[name] || [] new_validator = Inferno::DSL::FHIRValidation::Validator.new(, &) current_validators.reject! { |validator| validator.requirements == } current_validators << new_validator fhir_validators[name] = current_validators end |