From ee17b7dc740c10cf041bf4585011a67edc4b7380 Mon Sep 17 00:00:00 2001 From: a Date: Thu, 7 Sep 2023 12:56:10 -0500 Subject: [PATCH] Update FEP-fb2a to be compatible with profile links and provide more examples --- fep/fb2a/fep-fb2a.md | 103 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/fep/fb2a/fep-fb2a.md b/fep/fb2a/fep-fb2a.md index 9b4acf6..44d3d11 100644 --- a/fep/fb2a/fep-fb2a.md +++ b/fep/fb2a/fep-fb2a.md @@ -26,25 +26,120 @@ Rather than depending on an additional (and unnecessary) vocabulary, it makes se Thus, we can define a standard for actor metadata, largely drawing from prior art. -## 2. Defining actor metadata +## 2. Defining generic actor metadata as key-value pairs General-purpose actor metadata fields SHOULD be included in the `attachment` array on the actor. If a more specific property exists and is a better fit for the specific metadata being expressed, then implementations MAY use that instead of or in addition to the more generic actor metadata. -- Each metadata field MUST have a type of `Note`. +- Each generic metadata field SHOULD have a type of `Note`. - Each metadata field MUST have a property of `name` representing the name (key) of the field. - Each metadata field MUST have a property of `content` representing the content (value) of the field. -## 3. Backwards compatibility with legacy implementations +## 3. Defining generic actor metadata as links + +Actor metadata fields may also take the form of a link rather than a content value. + +- Each generic link SHOULD have a type of `Link`. +- Each link field MUST have a property of `href` representing the value of the link. +- Each link field SHOULD have a property of `name` representing a label for the link. +- Each link field SHOULD use `rel` values if an appropriate link relation exists. + +## 4. Backwards compatibility with legacy implementations of profile fields using incorrect schema.org IRIs (This section is non-normative.) -Existing implementations currently using `http://schema.org#PropertyValue` and `http://schema.org#value` may wish to maintain backwards compatibility during a transitional period. The following algorithm may be used to support the legacy implementations while also favoring the implementation within this FEP: +Existing implementations currently using the incorrect IRIs `http://schema.org#PropertyValue` and `http://schema.org#value` may wish to maintain backwards compatibility during a transitional period by serving both legacy representations as well as representations according to this FEP. The following algorithm may be used to support the legacy implementations while also favoring the implementation within this FEP: - Filter the `attachment` array for items of type `Note`. Take `name` and `content` from each remaining item. - If none are found, filter the `attachment` array for items of type `http://schema.org#PropertyValue`. Take `name` and `http://schema.org#value` from each remaining item. After some transitional period, implementations may wish to simplify their logic by filtering only for items of type `Note` and drop support for `http://schema.org#PropertyValue`, `http://schema.org#value`, and the schema.org context entirely (assuming those implementations do not use any other vocabulary from the schema.org context). +## 5. Examples of current legacy implementations compared to serialization according to this FEP + +Consider a profile which has the following profile fields: + +``` +Pronouns +: they/them + +My portfolio +: https://example.com/ +``` + +A legacy implementation might currently serialize these as such: + +``` +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + { + "sc": "http://schema.org#" + "PropertyValue": "sc:PropertyValue", + "value": "sc:value" + } + ], + "id": "https://social.example/someone" + "type": "Person", + "attachment": [ + { + "type": "PropertyValue", + "name": "Pronouns", + "value": "they/them" + }, + { + "type": "PropertyValue", + "name": "My portfolio", + "value": "example.com" + } + ] +} +``` + +For implementations that do not include the same incorrect IRI term mapping in their contexts, compaction would result in the following: + +``` +{ + "@context": "https://www.w3.org/ns/activitystreams", + "id": "https://social.example/someone" + "type": "Person", + "attachment": [ + { + "type": "http://schema.org#PropertyValue", + "name": "Pronouns", + "http://schema.org#PropertyValue": "they/them" + }, + { + "type": "http://schema.org#PropertyValue", + "name": "My portfolio", + "http://schema.org#PropertyValue": "example.com" + } + ] +} +``` + +Implementation according to this FEP might result in a simpler and more semantically correct serialization but equivalent representation like so: + +``` +{ + "@context": "https://www.w3.org/ns/activitystreams", + "id": "https://social.example/someone" + "type": "Person", + "attachment": [ + { + "type": "Note", + "name": "Pronouns", + "content": "they/them" + }, + { + "type": "Link", + "name": "My portfolio", + "href": "https://example.com", + "rel": ["nofollow", "noopener", "noreferrer", "me"] + } + ] +} +``` + ## References - [ActivityPub] Christine Lemmer Webber, Jessica Tallon, [ActivityPub](https://www.w3.org/TR/activitypub/), 2018