Logo
NeoArc Studio

GraphQL Lineage Tracking

Trace data from GraphQL operations through type definitions to model entities. Operations reference type definitions, type definitions use schemas, and schemas track lineage to properties in the data model.

GraphQL lineage tracking connects operations to the data model. Operations reference type definitions with field-level lineage to entity properties in model.neoarc. This creates full traceability from GraphQL query to canonical data model.

The GraphQL Lineage Chain

Lineage flows through the GraphQL type system:

1. Operation
Query, mutation, or subscription with arguments and return types
2. Type Definition
Object types with fields, scalars, and lineage entries per field pointing to model properties
3. Data Model
Entities and properties defined in model.neoarc, the canonical source of truth

How It Works

GraphQL operations reference schemas that serve as type definitions. Each schema field contains lineage entries mapping to model entity properties using sourceType: "graph" with graphFilePath: "model.neoarc".

{
  "sourceType": "graph",
  "graphFilePath": "model.neoarc",
  "nodeName": "Product",
  "nodeId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
  "propertyName": "Name"
}

Query Operation Lineage

Query operations retrieve data with full lineage tracking. The return type schema contains lineage entries for each field, mapping to the corresponding model entity properties.

GraphQL FieldSchema FieldModel EntityModel Property
ididProductProductId
namenameProductName
descriptiondescriptionProductDescription
pricepriceProductPrice
skuskuProductSKU
categorycategoryIdProductCategoryId

Mutation Operation Lineage

Mutations modify data with lineage tracking on both input and return types. Input types map input fields to model properties, while return types trace the response data back to the model.

Subscription Operation Lineage

Subscriptions provide real-time data with the same lineage tracking. The return type schema traces fields to model properties identically to queries and mutations.

Tracing from Operation to Model

Cross-Entity Lineage

GraphQL types often span multiple model entities. A schema for an Order type might map fields to both the Order entity and related entities such as Customer and Product.

Schema FieldModel EntityModel PropertyNotes
idOrderOrderIdPrimary identifier
customerIdCustomerCustomerIdReference to Customer entity
totalAmountOrderTotalAmountOrder total
statusOrderStatusCurrent order status
createdAtOrderCreatedAtOrder creation timestamp

Lineage Through Interfaces

When GraphQL types implement interfaces, lineage tracks through the implementations:

Custom Scalar Lineage

Custom scalars can have lineage notes documenting how the model property maps to the GraphQL scalar type:

ScalarModel Property TypeTransformation
DateTimeTimestampISO 8601 serialisation
MoneyDecimalString serialisation to avoid precision loss
EmailAddressStringRFC 5322 validation applied

Visualising in the Intent Graph

The Intent Graph captures the full GraphQL lineage chain:

EdgeFromToMeaning
depends-onGraphQL OperationSchemaOperation uses this schema for arguments or return types
maps-toSchema FieldModel PropertyField traces to this model entity property
derived-fromSchema FieldSchema FieldInherited field from parent schema

Why GraphQL Lineage Matters

Schema Evolution
Before deprecating a field, see which model properties it depends on and assess downstream impact
Performance Analysis
Trace queries to their underlying model entity access patterns
Federation Planning
Understand data ownership when splitting a monolithic schema into federated subgraphs
Type Generation
Generate model-aware type definitions from lineage metadata

Setting Up GraphQL Lineage

Related Content