Postel’s law saws “be liberal in what you accept from others”, but how liberal should an ActivityPub consumer be?
Flattening collects all properties of a node in a single map and labels all blank nodes with blank node identifiers. This ensures a shape of the data and consequently may drastically simplify the code required to process JSON-LD in certain applications.
…so I was thinking that flattening would help with making an ActivityPub consumer somewhat forgiving.
However, I’ve noticed that flattening turns property values into arrays. For example, this…
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://example.org/person",
"name": "Foo"
}
…flattens into this…
[
{
"@id": "https://example.org/person",
"https://www.w3.org/ns/activitystreams#name": [
{
"@value": "Foo"
}
]
}
]
Note that the value of the name
property is now an array.
So what’s the right thing to do if this array has more than one element? Should I use one of the elements (and if so, which one?), should I treat it as being unset, or something else?