Elektrine lite

← Feed

@evan@activitypub.space

Post #2537944

2026-05-14 20:41 UTC

@reiver@mastodon.social That's not true. Most of those are not correct AS2. Only '"type": "Banana"' is correct. Activity Streams says, The serialized JSON form of an Activity Streams 2.0 document MUST be consistent with what would be produced by the standard JSON-LD 1.0 Processing Algorithms and API [JSON-LD-API] Compaction Algorithm using, at least, the normative JSON-LD @context definition provided here. So, assuming that you've defined some Banana extension, your full code might look like this: { "@context": [ "https://www.w3.org/ns/activitystreams", { "ext": "https://banana.example/", "Banana": { "@type": "@id", "@id": "ext:Banana" } } ], "type": "Banana" } If you park all that context data at a context URL, you can have a much slimmer payload: { "@context": [ "https://www.w3.org/ns/activitystreams", "https://banana.example/" ], "type": "Banana" } If you don't define the extra context stuff, you have to use the full URL for the type: { "@context": "https://www.w3.org/ns/activitystreams", "type": "https://banana.example/Banana" } I prefer the slim one with the context URL. If you use a JSON-LD library for parsing your input, all the funky variants you're sharing get canonicalized into one easy-to-use one. And if you use it for formatting your output, you'll always produce nice, clean AS2.

Replies (1)

  • @evan@activitypub.space 2026-05-14 20:46

    Oh, and if you're using an AS2 type, you don't have to worry about the extra context URL, obvs: { "@context": "https://www.w3.org/ns/activitystreams", "type": "Person" }

    Open ##2537955