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
333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 333 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.
316 317 318 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 316 def errors @errors end |
#external_references ⇒ Array<Hash> (readonly)
Returns External type references.
322 323 324 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 322 def external_references @external_references end |
#validation_details ⇒ Array<Hash> (readonly)
Returns Detailed validation information.
325 326 327 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 325 def validation_details @validation_details end |
#warnings ⇒ Array<String> (readonly)
Returns Validation warnings.
319 320 321 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 319 def warnings @warnings end |
Instance Method Details
#has_external_references? ⇒ Boolean
Check if there are any external references
362 363 364 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 362 def has_external_references? !@external_references.empty? end |
#has_warnings? ⇒ Boolean
Check if there are any warnings
355 356 357 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 355 def has_warnings? !@warnings.empty? end |
#issue_count ⇒ Integer
Get total issue count (errors + warnings)
369 370 371 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 369 def issue_count @errors.size + @warnings.size end |
#summary ⇒ String
Get a summary of validation results
376 377 378 379 380 381 382 383 384 385 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 376 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)
348 349 350 |
# File 'lib/lutaml/uml_repository/validators/repository_validator.rb', line 348 def valid? @valid end |