Closed hacdias closed 1 year ago
I remember running into this issue while working on Gitea federation a few months ago. My solution was to use jsonld.WithContext
as you can see here.
Thanks @Ta180m!
It would be great to get some feedback from the author though, cc @mariusor. I would like to understand if this is a bug, or on purpose.
Maybe ask about this on the mailing list?
Hey @hacdias, apologies for the late reply.
So, @ta180m is right on all accounts:
I prefer the mailing list for questions because on github usually nothing happens, and it's more convenient for me to talk over email.
To use the JSON-LD @context, you need to use the mechanism suggested:
body, err := jsonld.WithContext(
jsonld.IRI(vocab.ActivityBaseURI),
jsonld.IRI(vocab.SecurityContextURI),
).Marshal(a)
The Context
property that you mentioned on the go-ap objects stems from the ActivityStreams vocabulary specification, and has nothing to do with the JSON-LD context, though I can understand the confusion. It should be commented in the source code with the details from the spec itself, which I was hoping that it gives an indication about its purpose.
@mariusor thanks for the context - no pun intended. I will then close this issue as it is not a bug!
I was considering using this library to encode some ActivityPub data I have on my website. However, I noticed that the
Context
field gets serialised tocontext
and not@context
. Is that on purpose? If so, why? And how could I output it as@context
?