1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-08 21:45:52 +00:00

FEP-2277: Improve Collection detection algorithm (#528)

Reviewed-on: https://codeberg.org/fediverse/fep/pulls/528
Co-authored-by: silverpill <silverpill@firemail.cc>
Co-committed-by: silverpill <silverpill@firemail.cc>
This commit is contained in:
silverpill
2025-03-18 20:27:18 +00:00
committed by silverpill
parent 2bad8012b7
commit 45d5fae978
+3 -3
View File
@@ -45,8 +45,8 @@ One way to divide objects into distinct classes is to look at their properties a
- Object
- Actor
- Activity
- Collection
- Activity (includes intransitive activities)
- Collection (includes collection pages)
- Link
The next section specifies an algorithm that classifies any ActivityPub object as one of these core types by analyzing object's shape. This technique is often referred to as [duck typing][DuckTyping].
@@ -58,7 +58,7 @@ The following algorithm can be used to determine the core type of the object:
1. If object has `href` property, return `Link`.
1. If object has `inbox` and `outbox` properties, return `Actor`.
1. If object has `actor` property, return `Activity`.
1. If object has `items`, `orderedItems` or `totalItems` property, return `Collection`.
1. If object has `items`, `orderedItems`, `totalItems`, `partOf`, `first`, `last`, `next`, `prev` or `current` property, return `Collection`.
1. Otherwise, return `Object`.
Application of this algorithm results in non-overlapping core types. For example, an actor with `items` property is still an actor and not a collection.