Object Relationship Mapping
Map which objects reference which, so object-level tests can follow ownership chains instead of guessing identifier pairs
Use when: the API exposes several object types with references between them, such as accounts, orders, invoices and files
Avoid when: a single flat object type is exposed with no relationships to reason about
Procedure
- List object types from schemas and responses, then record the ownership field each one carries: owner, tenant, organization or parent.
- Draw the reference graph: which object embeds, points at or lists another object's identifier.
- Mark edges where ownership can change over time, such as transferred accounts or shared workspaces.
- Identify list endpoints that return identifiers you do not own, since those feed directly into object-level tests.
- Note aggregation endpoints that read several object types, where a check on one type often gets forgotten.
- Persist the graph so later tests can say precisely which relationship a failing check would violate.
Signals
- A list endpoint returns identifiers belonging to objects outside the caller's tenant.
- An object references a parent by identifier alone, with no ownership field on the child record.
- Ownership is derived from a header or host rather than from the session, which invites confusion about who is asking.
- Shared or delegated access exists, meaning ownership is a set of principals rather than one column.
Patterns
1. Graph edge
account 1--n order ownership=account_id on order
order 1--n invoice ownership=order_id on invoice (derived, not stored)
2. Aggregation risk
GET /dashboard joins account, orders, invoices
-> any one missing ownership filter leaks the others' data
3. Change note
workspace.transfer() moves membership -> re-test edges after transfer
Pitfalls
- Assuming stored ownership when the field is derived at query time and can miss a filter.
- Ignoring shared-resource models where a single owner column does not exist.
- Building the graph from documentation while the implementation adds relationships the docs omit.
Done when
- Every object type has a recorded ownership mechanism and the reference graph covers all documented edges.
- Aggregation and shared-ownership cases are marked as higher-risk edges for the object-level phase.