Class: Lutaml::Xsd::PackageValidator
- Inherits:
-
Object
- Object
- Lutaml::Xsd::PackageValidator
- Defined in:
- lib/lutaml/xsd/package_validator.rb
Overview
Validates that a schema repository package is fully resolved Checks that all type, element, attribute, and group references are resolvable within the package
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(repository) ⇒ PackageValidator
constructor
A new instance of PackageValidator.
-
#validate_full_resolution ⇒ Hash
Validate that all references in the package are fully resolved.
Constructor Details
#initialize(repository) ⇒ PackageValidator
Returns a new instance of PackageValidator.
11 12 13 14 15 |
# File 'lib/lutaml/xsd/package_validator.rb', line 11 def initialize(repository) @repository = repository @errors = [] @warnings = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/lutaml/xsd/package_validator.rb', line 9 def errors @errors end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
9 10 11 |
# File 'lib/lutaml/xsd/package_validator.rb', line 9 def repository @repository end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
9 10 11 |
# File 'lib/lutaml/xsd/package_validator.rb', line 9 def warnings @warnings end |
Instance Method Details
#validate_full_resolution ⇒ Hash
Validate that all references in the package are fully resolved
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lutaml/xsd/package_validator.rb', line 19 def validate_full_resolution @errors = [] @warnings = [] # Check all type references validate_type_references # Check all element references validate_element_references # Check all attribute references validate_attribute_references # Check all group references validate_group_references # Check all attribute group references validate_attribute_group_references # Check imports/includes are all resolved validate_imports_and_includes { valid: @errors.empty?, errors: @errors, warnings: @warnings, statistics: { types_checked: count_type_references, elements_checked: count_element_references, attributes_checked: count_attribute_references, groups_checked: count_group_references, attribute_groups_checked: count_attribute_group_references, all_resolved: @errors.empty?, }, } end |