Problem
We track basic type relationships but could be more comprehensive. The current TypeRelationship interface is quite basic and doesn't capture the full richness of GraphQL type relationships.
Current Implementation
export interface TypeRelationship {
fromType: string;
toType: string;
fieldName: string;
isList: boolean;
}
This only captures field-to-type relationships, missing:
- Interface implementations
- Union memberships
- Directive applications
- Inheritance hierarchies
- Input/output type relationships
Enhanced Relationship Types
1. Interface Implementation
{
type: "implements",
implementer: "Product",
interface: "Node",
location: {...}
}
2. Union Membership
{
type: "union_member",
union: "SearchResult",
member: "Product",
location: {...}
}
3. Directive Application
{
type: "directive",
target: "Product.price",
directive: "materializer",
arguments: {...},
location: {...}
}
4. Input/Output Relationships
{
type: "input_output",
operation: "createProduct",
input: "ProductInput",
output: "Product",
location: {...}
}
Benefits
- Better Visualization: Schema visualizer can show richer relationships
- Enhanced Navigation: Go-to-definition for interfaces, unions, etc.
- Impact Analysis: Understand what's affected by type changes
- Documentation: Auto-generate relationship documentation
- Validation: Detect broken relationships
Implementation Approach
- Extend TypeRelationship: Add discriminated union for different relationship types
- Enhanced Indexing: Capture more relationship types during schema parsing
- Backward Compatibility: Maintain existing field relationships
- Visualization Updates: Update schema visualizer to show new relationships
- API Extensions: Add methods to query specific relationship types
Acceptance Criteria
Problem
We track basic type relationships but could be more comprehensive. The current
TypeRelationshipinterface is quite basic and doesn't capture the full richness of GraphQL type relationships.Current Implementation
This only captures field-to-type relationships, missing:
Enhanced Relationship Types
1. Interface Implementation
2. Union Membership
3. Directive Application
4. Input/Output Relationships
Benefits
Implementation Approach
Acceptance Criteria