-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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
- Track interface implementations
- Track union memberships
- Track directive applications
- Track input/output relationships
- Maintain backward compatibility
- Update schema visualizer to show enhanced relationships
- Add query methods for specific relationship types
- Performance impact is minimal