Class: Lutaml::Xsd::ElementFormDefaultRule

Inherits:
ValidationRule show all
Defined in:
lib/lutaml/xsd/xsd_spec_validator.rb

Overview

Validates elementFormDefault and attributeFormDefault settings

Instance Attribute Summary

Attributes inherited from ValidationRule

#version

Instance Method Summary collapse

Methods inherited from ValidationRule

#initialize

Constructor Details

This class inherits a constructor from Lutaml::Xsd::ValidationRule

Instance Method Details

#validate(repository) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/lutaml/xsd/xsd_spec_validator.rb', line 95

def validate(repository)
  errors = []
  warnings = []

  get_schemas(repository).each do |schema_file, schema|
    # XSD best practice: explicitly set elementFormDefault
    warnings << "Schema #{File.basename(schema_file)} does not explicitly set elementFormDefault (defaults to 'unqualified')" unless schema.element_form_default
  end

  { errors: errors, warnings: warnings }
end