wiki.trwnh.com/content/tech/spec/activitypub/gotchas/orderedItems.md

21 lines
813 B
Markdown
Raw Normal View History

2023-04-06 06:44:39 +00:00
## DO NOT CONFUSE ITEMS AND ORDEREDITEMS
2023-03-24 21:37:31 +00:00
2023-04-06 06:44:39 +00:00
`items` indicates that this is a Collection
2023-03-24 21:37:31 +00:00
however, `orderedItems` is valid on both Collection and OrderedCollection! it is defined like this in the as2 context:
```json
2023-04-06 06:44:39 +00:00
{
"orderedItems": {
"@id": "as:items",
"@type": "@id",
"@container": "@list"
}
2023-03-24 21:37:31 +00:00
}
```
so it is basically just an alias for `items` where it MUST be an array, and the array's order matters. (if it were `@container: set`, then it MUST be an array, but the array's order does not matter.)
### tangent: a Collection may be ordered without being an OrderedCollection
OrderedCollection is defined as strictly reverse chronological by ActivityPub. however, other orderings are valid on regular Collections. the use of the `orderedItems` term allows plain-JSON implementations to do exactly this.