Class: Cocina::Models::Validators::DescriptionEventDateVisitorValidator
- Inherits:
-
BaseDescriptionVisitorValidator
- Object
- BaseDescriptionVisitorValidator
- Cocina::Models::Validators::DescriptionEventDateVisitorValidator
- Defined in:
- lib/cocina/models/validators/description_event_date_visitor_validator.rb
Overview
Validates that event date structuredValue entries with a type also have a value.
Instance Method Summary collapse
Methods inherited from BaseDescriptionVisitorValidator
#path_to_s, #visit_array, #visit_obj
Instance Method Details
#validate! ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cocina/models/validators/description_event_date_visitor_validator.rb', line 15 def validate! return if error_paths.empty? raise ValidationError, "Missing value for type in description: #{error_paths.join(', ')}" end |
#visit_hash(hash:, path:) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/cocina/models/validators/description_event_date_visitor_validator.rb', line 8 def visit_hash(hash:, path:) return unless hash[:type] && !hash[:value] return unless event_date_structured_value?(path) error_paths << path_to_s(path) end |