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
348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 348 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.
331 332 333 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 331 def errors @errors end |
#external_references ⇒ Array<Hash> (readonly)
Returns External type references.
337 338 339 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 337 def external_references @external_references end |
#validation_details ⇒ Array<Hash> (readonly)
Returns Detailed validation information.
340 341 342 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 340 def validation_details @validation_details end |
#warnings ⇒ Array<String> (readonly)
Returns Validation warnings.
334 335 336 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 334 def warnings @warnings end |
Instance Method Details
#has_external_references? ⇒ Boolean
Check if there are any external references
377 378 379 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 377 def has_external_references? !@external_references.empty? end |
#has_warnings? ⇒ Boolean
Check if there are any warnings
370 371 372 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 370 def has_warnings? !@warnings.empty? end |
#issue_count ⇒ Integer
Get total issue count (errors + warnings)
384 385 386 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 384 def issue_count @errors.size + @warnings.size end |
#summary ⇒ String
Get a summary of validation results
391 392 393 394 395 396 397 398 399 400 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 391 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)
363 364 365 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 363 def valid? @valid end |