crossposted from Github
Generally, this question extends to the following properties in popular practice:
-
attachment
(order of attachments sometimes matters)
-
tag
(order of tags can matter, e.g. tumblr)
-
oneOf
(order of poll options often matters)
-
anyOf
(order of poll options often matters)
Per SocialHub discussion, our options are, from least messy migration to most messy migration:
-
1: Manually override the term definition, per-document. This allows producers to opt into ordering for these properties, on a per-document basis. However, only LD-aware consumers will be able to tell the difference. (AS2 also forbids overriding AS2 terms, but consider this a willful violation.)
-
2: Make normative changes, for everyone. This changes the AS2 context to align more closely to what most producers are already doing or assuming, essentially opting into (1) for everyone. However, some old documents might no longer be valid, if they contain a single item rather than an array.
-
3: Use new orderedX
properties. This removes the ambiguity completely, for both LD-aware and plain-JSON consumers; however, it requires plain-JSON consumers to check for the new orderedX
properties, and this may result in producers duplicating information in both the unordered and ordered properties, which has unintended consequences for the LD representation.
For example, given the following:
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"orderedAttachment": {
"@id": "as:attachment",
"@type": "@id",
"@container": "@list"
}
}
],
"orderedAttachment": ["one", "two"],
"attachment": ["one", "two"]
}
It expands into the following:
[
{
"https://www.w3.org/ns/activitystreams#attachment": [
{
"@id": "one"
},
{
"@id": "two"
},
{
"@list": [
{
"@id": "one"
},
{
"@id": "two"
}
]
}
]
}
]
Compacting against only AS2 without the orderedAttachment
extension results in this:
{
"@context": "https://www.w3.org/ns/activitystreams",
"attachment": [
"one",
"two",
{
"@list": [
"one",
"two"
]
}
]
}
- 4: Redefine these properties as collections. This allows the use of
ordereditems
. However, existing implementations will almost certainly be confused by this change. In some ways, this is a harder break than (3), but with cleaner results. Funnily enough, no changes are needed to the normative context, only to convention (although AS2-Vocab examples could be reworked).
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Question",
"name": "What is the answer?",
"oneOf": {
"type": "Collection",
"orderedItems": [
{
"type": "Note",
"name": "Option A"
},
{
"type": "Note",
"name": "Option B"
}
]
}
}