Class: Lutaml::Xsd::ValidationError
- Inherits:
-
Model::Serializable
- Object
- Model::Serializable
- Lutaml::Xsd::ValidationError
- Defined in:
- lib/lutaml/xsd/validation_error.rb
Overview
Represents a single validation error with structured information
Class Method Summary collapse
-
.create(field:, message:, value: nil, constraint: nil) ⇒ ValidationError
Factory method for creating validation errors with type conversion.
Instance Method Summary collapse
-
#to_s ⇒ String
Format as human-readable string.
Class Method Details
.create(field:, message:, value: nil, constraint: nil) ⇒ ValidationError
Factory method for creating validation errors with type conversion
25 26 27 28 29 30 31 32 |
# File 'lib/lutaml/xsd/validation_error.rb', line 25 def self.create(field:, message:, value: nil, constraint: nil) new( field: field.to_s, message: , value: value&.to_s, constraint: constraint, ) end |
Instance Method Details
#to_s ⇒ String
Format as human-readable string
36 37 38 39 40 41 |
# File 'lib/lutaml/xsd/validation_error.rb', line 36 def to_s parts = ["#{field}: #{}"] parts << "(value: #{value})" if value parts << "[constraint: #{constraint}]" if constraint parts.join(" ") end |