Class: Lutaml::UmlRepository::Validators::ValidationResult
- Inherits:
-
Object
- Object
- Lutaml::UmlRepository::Validators::ValidationResult
- Defined in:
- lib/lutaml/uml_repository/validators/repository_validator.rb
Overview
ValidationResult encapsulates the results of repository validation
Instance Attribute Summary collapse
-
#errors ⇒ Array<String>
readonly
Validation errors.
-
#external_references ⇒ Array<Hash>
readonly
External type references.
-
#validation_details ⇒ Array<Hash>
readonly
Detailed validation information.
-
#warnings ⇒ Array<String>
readonly
Validation warnings.
Instance Method Summary collapse
-
#has_external_references? ⇒ Boolean
Check if there are any external references.
-
#has_warnings? ⇒ Boolean
Check if there are any warnings.
-
#initialize(valid:, errors:, warnings:, external_references: [], validation_details: nil) ⇒ ValidationResult
constructor
information.
-
#issue_count ⇒ Integer
Get total issue count (errors + warnings).
-
#summary ⇒ String
Get a summary of validation results.
-
#valid? ⇒ Boolean
Check if validation passed (no errors).
Constructor Details
#initialize(valid:, errors:, warnings:, external_references: [], validation_details: nil) ⇒ ValidationResult
information
336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 336 def initialize( valid:, errors:, warnings:, external_references: [], validation_details: nil ) @valid = valid @errors = errors.freeze @warnings = warnings.freeze @external_references = external_references.freeze @validation_details = validation_details&.freeze freeze end |
Instance Attribute Details
#errors ⇒ Array<String> (readonly)
Returns Validation errors.
319 320 321 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 319 def errors @errors end |
#external_references ⇒ Array<Hash> (readonly)
Returns External type references.
325 326 327 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 325 def external_references @external_references end |
#validation_details ⇒ Array<Hash> (readonly)
Returns Detailed validation information.
328 329 330 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 328 def validation_details @validation_details end |
#warnings ⇒ Array<String> (readonly)
Returns Validation warnings.
322 323 324 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 322 def warnings @warnings end |
Instance Method Details
#has_external_references? ⇒ Boolean
Check if there are any external references
365 366 367 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 365 def has_external_references? !@external_references.empty? end |
#has_warnings? ⇒ Boolean
Check if there are any warnings
358 359 360 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 358 def has_warnings? !@warnings.empty? end |
#issue_count ⇒ Integer
Get total issue count (errors + warnings)
372 373 374 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 372 def issue_count @errors.size + @warnings.size end |
#summary ⇒ String
Get a summary of validation results
379 380 381 382 383 384 385 386 387 388 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 379 def summary if valid? && !has_warnings? "Validation passed: no issues found" elsif valid? "Validation passed with #{@warnings.size} warning(s)" else "Validation failed with #{@errors.size} error(s) and " \ "#{@warnings.size} warning(s)" end end |
#valid? ⇒ Boolean
Check if validation passed (no errors)
351 352 353 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 351 def valid? @valid end |