Libove Blog

Personal Blog about anything - mostly programming, cooking and random thoughts

Tag: golang

#

When using go-ap/jsonld, to extend the context by a term use:

jsonld.WithContext(
	jsonld.Context{
		{IRI: jsonld.IRI(vocab.ActivityBaseURI)},
		{Term: jsonld.Term("Hashtag"), IRI: jsonld.IRI("https://www.w3.org/ns/activitystreams#Hashtag")},
	},
)

Instead of:

var ApEncoder = jsonld.WithContext(
	jsonld.IRI(vocab.ActivityBaseURI),
	jsonld.Context{
		{Term: jsonld.Term("Hashtag"), IRI: jsonld.IRI("https://www.w3.org/ns/activitystreams#Hashtag")},
	},
)

The latter ignores the terms.

#golang #dev #activitypub #fediverse