Change some inline term definitions to new JSON-LD context
This commit is contained in:
parent
9e12fa254e
commit
5a7ea1dd2f
@ -4,6 +4,7 @@ module ContextHelper
|
|||||||
NAMED_CONTEXT_MAP = {
|
NAMED_CONTEXT_MAP = {
|
||||||
activitystreams: 'https://www.w3.org/ns/activitystreams',
|
activitystreams: 'https://www.w3.org/ns/activitystreams',
|
||||||
security: 'https://w3id.org/security/v1',
|
security: 'https://w3id.org/security/v1',
|
||||||
|
miscellany: 'https://purl.archive.org/socialweb/miscellany',
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
CONTEXT_EXTENSION_MAP = {
|
CONTEXT_EXTENSION_MAP = {
|
||||||
|
@ -4,10 +4,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
|||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
include FormattingHelper
|
include FormattingHelper
|
||||||
|
|
||||||
context :security
|
context :security, :miscellany
|
||||||
|
|
||||||
context_extensions :manually_approves_followers, :featured, :also_known_as,
|
context_extensions :featured, :also_known_as,
|
||||||
:moved_to, :property_value, :discoverable, :olm, :suspended,
|
:property_value, :discoverable, :olm, :suspended,
|
||||||
:memorial, :indexable, :attribution_domains
|
:memorial, :indexable, :attribution_domains
|
||||||
|
|
||||||
attributes :id, :type, :following, :followers,
|
attributes :id, :type, :following, :followers,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
|
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
|
||||||
context_extensions :hashtag
|
context :miscellany
|
||||||
|
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||||
include FormattingHelper
|
include FormattingHelper
|
||||||
|
|
||||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count
|
context :miscellany
|
||||||
|
|
||||||
|
context_extensions :atom_uri, :conversation, :voters_count
|
||||||
|
|
||||||
attributes :id, :type, :summary,
|
attributes :id, :type, :summary,
|
||||||
:in_reply_to, :published, :url,
|
:in_reply_to, :published, :url,
|
||||||
@ -254,7 +256,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||||||
end
|
end
|
||||||
|
|
||||||
class TagSerializer < ActivityPub::Serializer
|
class TagSerializer < ActivityPub::Serializer
|
||||||
context_extensions :hashtag
|
context :miscellany
|
||||||
|
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
|
||||||
|
16
config/initializers/json_ld_miscellany.rb
Normal file
16
config/initializers/json_ld_miscellany.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
# This file generated automatically from https://purl.archive.org/socialweb/miscellany
|
||||||
|
require 'json/ld'
|
||||||
|
class JSON::LD::Context
|
||||||
|
add_preloaded("http://purl.archive.org/socialweb/miscellany") do
|
||||||
|
new(processingMode: "json-ld-1.1", term_definitions: {
|
||||||
|
"Hashtag" => TermDefinition.new("Hashtag", id: "https://www.w3.org/ns/activitystreams#Hashtag", simple: true),
|
||||||
|
"as" => TermDefinition.new("as", id: "https://www.w3.org/ns/activitystreams#", simple: true, prefix: true),
|
||||||
|
"manuallyApprovesFollowers" => TermDefinition.new("manuallyApprovesFollowers", id: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"),
|
||||||
|
"movedTo" => TermDefinition.new("movedTo", id: "https://www.w3.org/ns/activitystreams#movedTo", type_mapping: "@id"),
|
||||||
|
"sensitive" => TermDefinition.new("sensitive", id: "https://www.w3.org/ns/activitystreams#sensitive", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"),
|
||||||
|
"xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
alias_preloaded("https://purl.archive.org/socialweb/miscellany", "http://purl.archive.org/socialweb/miscellany")
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user