Class: Lutaml::Xsd::SchemaDependencyAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/schema_dependency_analyzer.rb

Overview

Analyzes schema dependencies and builds dependency trees

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package) ⇒ SchemaDependencyAnalyzer

Returns a new instance of SchemaDependencyAnalyzer.

Parameters:



10
11
12
# File 'lib/lutaml/xsd/schema_dependency_analyzer.rb', line 10

def initialize(package)
  @package = package
end

Instance Attribute Details

#packageObject (readonly)

Returns the value of attribute package.



7
8
9
# File 'lib/lutaml/xsd/schema_dependency_analyzer.rb', line 7

def package
  @package
end

Instance Method Details

#build_dependency_tree(entrypoints, depth: nil) ⇒ Array<Hash>

Build dependency tree from entrypoints

Parameters:

  • entrypoints (Array<Hash>)

    Entrypoint information

  • depth (Integer, nil) (defaults to: nil)

    Maximum depth (nil for unlimited)

Returns:

  • (Array<Hash>)

    Tree structure



18
19
20
21
22
23
24
25
26
# File 'lib/lutaml/xsd/schema_dependency_analyzer.rb', line 18

def build_dependency_tree(entrypoints, depth: nil)
  package.load_repository
  visited = Set.new

  entrypoints.map do |entrypoint|
    build_tree_node(entrypoint[:schema], entrypoint[:file], visited, 0,
                    depth)
  end
end