-
-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Summary
Add support for FEP-5711 Inverse Properties for Collections vocabulary to Fedify's Vocabulary API. This FEP defines inverse properties for ActivityPub collections that help identify the relationship between collections and their parent objects/actors.
Problem
Currently, Fedify's Vocabulary API does not include the vocabulary properties defined in FEP-5711. This FEP introduces important inverse properties such as likesOf
, sharesOf
, repliesOf
, inboxOf
, outboxOf
, followersOf
, followingOf
, and likedOf
that provide two-way verification mechanisms for collections and help prevent spoofing attacks.
Without these properties, developers cannot:
- Verify that a collection is legitimately associated with a specific object or actor
- Implement proper anti-spoofing measures for collection relationships
- Use these standardized inverse properties in their ActivityPub implementations
- Take advantage of the improved interoperability that these properties provide
Proposed Solution
Add the following properties from FEP-5711 to Fedify's Vocabulary API:
Object-related inverse properties
likesOf
— identifies the object for which a collection serves as thelikes
propertysharesOf
— identifies the object for which a collection serves as theshares
propertyrepliesOf
— identifies the object for which a collection serves as thereplies
property
Actor-related inverse properties
inboxOf
— identifies the actor for which a collection serves as theinbox
propertyoutboxOf
— identifies the actor for which a collection serves as theoutbox
propertyfollowersOf
— identifies the actor for which a collection serves as thefollowers
propertyfollowingOf
— identifies the actor for which a collection serves as thefollowing
propertylikedOf
— identifies the actor for which a collection serves as theliked
property
All properties should be:
- Added to the appropriate collection types (
Collection
,OrderedCollection
, etc.) - Functional properties (single value)
- Have proper domain (
as:Collection
) and range (as:Object
) specifications - Include proper TypeScript types and documentation
Alternatives Considered
- Wait for wider adoption — However, FEP-5711 provides clear security and interoperability benefits that justify early adoption
- Custom implementation by developers — This would lead to inconsistent implementations and defeat the purpose of having a standardized vocabulary API
- Manual property addition — Fedify's vocabulary API is code-generated, making manual additions impractical
Scope / Dependencies
Affected components
- Vocabulary API code generation (YAML files in
fedify/vocab/
directory) - Collection-related type definitions
- TypeScript type exports
- Preloaded JSON-LD contexts (
packages/fedify/src/runtime/contexts.ts
) - Documentation and examples
Dependencies
- FEP-5711 specification
- Context definition:
https://w3id.org/fep/5711
Implementation approach
- Add properties to existing collection YAML files in the vocabulary directory
- Follow existing patterns for property definitions
- IMPORTANT: Add the FEP-5711 context to
preloadedContexts
inpackages/fedify/src/runtime/contexts.ts
sincehttps://w3id.org/fep/5711
does not currently serve a JSON-LD context document, which would cause JSON-LD processors to malfunction - Add appropriate TypeScript types and accessors
- Update documentation with usage examples
Critical implementation note
The https://w3id.org/fep/5711
URL does not currently serve a working JSON-LD context. To prevent JSON-LD processor errors, the context definition must be added to Fedify's preloadedContexts
object with the appropriate property mappings for all 8 inverse properties:
"https://w3id.org/fep/5711": {
"@context": {
"likesOf": {
"@id": "https://w3id.org/fep/5711#likesOf",
"@type": "@id"
},
"sharesOf": {
"@id": "https://w3id.org/fep/5711#sharesOf",
"@type": "@id"
},
"repliesOf": {
"@id": "https://w3id.org/fep/5711#repliesOf",
"@type": "@id"
},
"inboxOf": {
"@id": "https://w3id.org/fep/5711#inboxOf",
"@type": "@id"
},
"outboxOf": {
"@id": "https://w3id.org/fep/5711#outboxOf",
"@type": "@id"
},
"followersOf": {
"@id": "https://w3id.org/fep/5711#followersOf",
"@type": "@id"
},
"followingOf": {
"@id": "https://w3id.org/fep/5711#followingOf",
"@type": "@id"
},
"likedOf": {
"@id": "https://w3id.org/fep/5711#likedOf",
"@type": "@id"
}
}
}
This addition aligns with Fedify's policy of accepting vocabulary contributions that are specified in FEPs, making it a straightforward addition to the project.