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
346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 346 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.
329 330 331 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 329 def errors @errors end |
#external_references ⇒ Array<Hash> (readonly)
Returns External type references.
335 336 337 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 335 def external_references @external_references end |
#validation_details ⇒ Array<Hash> (readonly)
Returns Detailed validation information.
338 339 340 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 338 def validation_details @validation_details end |
#warnings ⇒ Array<String> (readonly)
Returns Validation warnings.
332 333 334 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 332 def warnings @warnings end |
Instance Method Details
#has_external_references? ⇒ Boolean
Check if there are any external references
375 376 377 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 375 def has_external_references? !@external_references.empty? end |
#has_warnings? ⇒ Boolean
Check if there are any warnings
368 369 370 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 368 def has_warnings? !@warnings.empty? end |
#issue_count ⇒ Integer
Get total issue count (errors + warnings)
382 383 384 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 382 def issue_count @errors.size + @warnings.size end |
#summary ⇒ String
Get a summary of validation results
389 390 391 392 393 394 395 396 397 398 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 389 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)
361 362 363 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 361 def valid? @valid end |