We represent links (i.e. both children and references) by their id.
How do we handle the case that the node with this id is not logically contained in the result set (because it's out of scope of the query)?
Aspects
- Distinguish invalid link targets from not loaded ones
- Know the type of the target node (might be useful for e.g. EMF-based implementation)
Possible representations
Just target id
Example:
{
"containsProxies": true
"nodes": [
{
"id": "a",
"type": "PetOwner",
"references": {
"myPet": "x" // no node with id "x" present
}
}
]
}
- Less data
- Cannot distinguish between invalid id and unresolved id
- Server could send back a flag whether data contained any proxies
Proxy for target
Example:
{
"nodes": [
{
"id": "a",
"type": "PetOwner",
"references": {
"myPet": "x"
}
},
{
"id": "x",
"type": "Dog",
"state": "[full | proxy | invalid]"
}
]
}
- After just reading the list of nodes, we know whether we have an unresolved reference
- We can easily know reference target type
- Can differentiate between invalid id and unresolved id
- If querying closure and result contains invalid id, client can identify them
=> Decision: For now, don’t store proxies in node list. Might be changed in the future (compatible, additive API change).
We represent links (i.e. both children and references) by their id.
How do we handle the case that the node with this id is not logically contained in the result set (because it's out of scope of the query)?
Aspects
Possible representations
Just target id
Example:
{ "containsProxies": true "nodes": [ { "id": "a", "type": "PetOwner", "references": { "myPet": "x" // no node with id "x" present } } ] }Proxy for target
Example:
{ "nodes": [ { "id": "a", "type": "PetOwner", "references": { "myPet": "x" } }, { "id": "x", "type": "Dog", "state": "[full | proxy | invalid]" } ] }=> Decision: For now, don’t store proxies in node list. Might be changed in the future (compatible, additive API change).