pub struct SchemaDependencyGraph { /* private fields */ }Expand description
Schema dependency graph for analyzing type relationships.
This graph tracks which types depend on which other types, enabling:
- Circular dependency detection
- Unused type detection
- Impact analysis for schema changes
Implementations§
Source§impl SchemaDependencyGraph
impl SchemaDependencyGraph
Sourcepub fn build(schema: &CompiledSchema) -> Self
pub fn build(schema: &CompiledSchema) -> Self
Build a dependency graph from a compiled schema.
This analyzes all types, queries, mutations, and subscriptions to build a complete dependency graph.
Sourcepub fn dependencies_of(&self, type_name: &str) -> Vec<String>
pub fn dependencies_of(&self, type_name: &str) -> Vec<String>
Get all types that a given type depends on (outgoing edges).
Sourcepub fn dependents_of(&self, type_name: &str) -> Vec<String>
pub fn dependents_of(&self, type_name: &str) -> Vec<String>
Get all types that depend on a given type (incoming edges).
Sourcepub fn type_count(&self) -> usize
pub fn type_count(&self) -> usize
Get the total number of types in the graph.
Sourcepub fn find_cycles(&self) -> Vec<CyclePath>
pub fn find_cycles(&self) -> Vec<CyclePath>
Find all circular dependencies in the schema.
Returns a list of cycle paths. Each cycle is reported once, starting from the lexicographically smallest type name.
Sourcepub fn find_unused(&self) -> Vec<String>
pub fn find_unused(&self) -> Vec<String>
Find all types that have no incoming references (orphaned types).
Root types (Query, Mutation, Subscription) are excluded from this list as they are always considered used.
Sourcepub fn impact_of_deletion(&self, type_name: &str) -> ChangeImpact
pub fn impact_of_deletion(&self, type_name: &str) -> ChangeImpact
Analyze the impact of deleting a type from the schema.
Returns all types that would be affected (transitively) by removing the specified type.
Sourcepub fn transitive_dependencies(&self, type_name: &str) -> HashSet<String>
pub fn transitive_dependencies(&self, type_name: &str) -> HashSet<String>
Get transitive dependencies of a type (all types it depends on, recursively).
Sourcepub fn transitive_dependents(&self, type_name: &str) -> HashSet<String>
pub fn transitive_dependents(&self, type_name: &str) -> HashSet<String>
Get transitive dependents of a type (all types that depend on it, recursively).
Trait Implementations§
Source§impl Clone for SchemaDependencyGraph
impl Clone for SchemaDependencyGraph
Source§fn clone(&self) -> SchemaDependencyGraph
fn clone(&self) -> SchemaDependencyGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more