Open joswarmer opened 8 months ago
I read the spec. as: if we include a particular reference feature in a node's serialization, then we must state targets = []
, but that doesn't mean we have to include { reference: <meta-pointer>, targets: [] }
in a node's serialization – in particular not if we don't know the language at that time. If we do know the language, it's helpful to include it.
So the repo can give either of the two as a result.
but that doesn't mean we have to include
{ reference: <meta-pointer>, targets: [] }
in
My question is not whether we have to include it, that is clear, the question is whether we should do this or not, especially if the repo does not know the language. If we do include it, we show the fact that this node was stored with such a reference in the past (otherwise we would know this reference at all). This means that the answer to the client exposes some indirect information.
From a spec point of view, it would be valid to have the empty targets only if we've seen them before. However, this makes it hard to test (as it depends on other tests executed before). So from a practical point of view, I'd always include it for a repo that knows the language, and never include it for repos without language knowledge.
In The serialization specification it says:
value
= null;children
= empty array;targets
= empty array;So so can get the following (incomplete for shortness) piece of JSON to be stored:
Assume we get the following json to store next:
We must accept this, and since the node does not have any references in the chunk, the reference to "ID-ANY". needs to be removed.
In the repo this leads to questions.
Doing a retrieve of node " after the second store above: can result in the references section as either:
or
Leading to different JSON chunks to be retrieved.
Especially in a repo that does not know the language this can be subtly different.
The question is: what should/must a repo return when a reference has empty targets. Nota that the answer might be different for a repo that does know the language versus a repo that does not know the language.