diff --git a/context.py b/context.py index 9afa78d79..20efb02d9 100644 --- a/context.py +++ b/context.py @@ -14,6 +14,7 @@ validContexts = ( "https://w3id.org/security/v1", "*/apschema/v1.9", "*/apschema/v1.21", + "*/apschema/v1.20", "*/litepub-0.1.jsonld", "https://litepub.social/litepub/context.jsonld" ) @@ -100,6 +101,43 @@ def getApschemaV1_9() -> {}: } +def getApschemaV1_20() -> {}: + # https://domain/apschema/v1.20 + return { + "@context": + { + "as": "https://www.w3.org/ns/activitystreams#", + "zot": "https://zap.dog/apschema#", + "toot": "http://joinmastodon.org/ns#", + "ostatus": "http://ostatus.org#", + "schema": "http://schema.org#", + "litepub": "http://litepub.social/ns#", + "sm": "http://smithereen.software/ns#", + "conversation": "ostatus:conversation", + "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "oauthRegistrationEndpoint": "litepub:oauthRegistrationEndpoint", + "sensitive": "as:sensitive", + "movedTo": "as:movedTo", + "copiedTo": "as:copiedTo", + "alsoKnownAs": "as:alsoKnownAs", + "inheritPrivacy": "as:inheritPrivacy", + "EmojiReact": "as:EmojiReact", + "commentPolicy": "zot:commentPolicy", + "topicalCollection": "zot:topicalCollection", + "eventRepeat": "zot:eventRepeat", + "emojiReaction": "zot:emojiReaction", + "expires": "zot:expires", + "directMessage": "zot:directMessage", + "Category": "zot:Category", + "replyTo": "zot:replyTo", + "PropertyValue": "schema:PropertyValue", + "value": "schema:value", + "discoverable": "toot:discoverable", + "wall": "sm:wall" + } + } + + def getApschemaV1_21() -> {}: # https://domain/apschema/v1.21 return { diff --git a/pyjsonld.py b/pyjsonld.py index fec0a1e34..1a598c5d2 100644 --- a/pyjsonld.py +++ b/pyjsonld.py @@ -39,6 +39,7 @@ from collections import deque, namedtuple from numbers import Integral, Real from context import getApschemaV1_9 +from context import getApschemaV1_20 from context import getApschemaV1_21 from context import getLitepubV0_1 from context import getLitepubSocial @@ -408,6 +409,13 @@ def load_document(url): 'document': getApschemaV1_9() } return doc + elif url.endswith('/apschema/v1.20'): + doc = { + 'contextUrl': None, + 'documentUrl': url, + 'document': getApschemaV1_20() + } + return doc elif url.endswith('/apschema/v1.21'): doc = { 'contextUrl': None,