Skip to content

Endpoints object serializes with invalid "type": "as:Endpoints" in actor JSON #576

@rmdes

Description

@rmdes

Description

When Fedify serializes an actor's endpoints property to JSON-LD (compacted), it includes "type": "as:Endpoints" in the output:

"endpoints": {
    "type": "as:Endpoints",
    "sharedInbox": "https://example.com/activitypub/inbox"
}

The as:Endpoints type does not exist in the ActivityStreams JSON-LD context. The endpoints property in the ActivityPub spec is defined as a plain object with optional properties (sharedInbox, proxyUrl, oauthAuthorizationEndpoint, etc.) — it has no type.

Validation Failure

browser.pub reports two errors:

/endpoints: ❌ Invalid endpoints, unknown properties: type (@type)
/endpoints/type: ❌ Type not found: as:Endpoints

All other actor fields pass validation.

Root Cause

In packages/vocab/src/endpoints.yaml, the Endpoints class has entity: false, but the code generator in packages/vocab-tools/src/codec.ts (line ~200) unconditionally emits:

values["@type"] = [${JSON.stringify(type.uri)}];

for all classes, including non-entity ones. When the JSON-LD is compacted, this becomes "type": "as:Endpoints".

Expected Behavior

The endpoints object should be serialized without a type property:

"endpoints": {
    "sharedInbox": "https://example.com/activitypub/inbox"
}

Suggested Fix

Classes with entity: false (like Endpoints, PropertyValue, Hashtag) could skip emitting @type during toJsonLd(), or the Endpoints class specifically could omit it since as:Endpoints isn't in the AS2 vocabulary.

Environment

  • Fedify: ^1.10.3
  • Discovered via browser.pub validation of a Fedify-powered ActivityPub server

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions