immers-space / guppe

Federated social groups with ActivityPub, NodeJS, Express, and Mongodb
https://a.gup.pe
GNU Affero General Public License v3.0
192 stars 16 forks source link

Invalid JSON-LD context #107

Open zotanmew opened 3 weeks ago

zotanmew commented 3 weeks ago

Heya, a.gup.pe is not generating a valid JSON-LD context. According to the specification, redefining keywords is not permitted.

If you fetch the outbox of any guppe group (or receive an activity from guppe), the context will look something like this:

  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "@context": {
        "PropertyValue": "http://schema.org/#PropertyValue"
      }
    }
  ]

The nested @context causes every JSON-LD compliant parser to throw an exception. Since I presume you simply wanted to add the term definition for PropertyValue, the context should look like this instead:

  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "PropertyValue": "http://schema.org/#PropertyValue"
    }
  ]

I don't know the details of the ActivitypubExpress library, as used here: https://github.com/immers-space/guppe/blob/7d44a6df88a4a60e05ad6360aac6835e291b0ced/index.js#L54

But I presume the issue lies here: https://github.com/immers-space/guppe/blob/7d44a6df88a4a60e05ad6360aac6835e291b0ced/data/context.json#L1-L5