fediverse-devnet / feditest-tests-fediverse

The tests for the fediverse testsuite
MIT License
5 stars 4 forks source link

Test that every JSON-LD file has the minimum @context values #50

Open jernst opened 1 month ago

jernst commented 1 month ago
steve-bate commented 1 month ago

The "https://w3id.org/security/v1" @context is only required in the Mastodon-compatible Actor documents (and maybe other implementation variants that use those terms). It's not needed (for any implementation I know) in non-Actor documents.

There is no hard requirement for "https://www.w3.org/ns/activitystreams" to be in the @context or that there is any @context at all. AS2 Section 2.1:

When a JSON-LD enabled Activity Streams 2.0 implementation encounters a JSON document identified using the " application/activity+json" MIME media type, and that document does not contain a @context property whose value includes a reference to the normative Activity Streams 2.0 JSON-LD @context definition, the implementation must assume that the normative @context definition still applies.

The requirement for the explicit "https://www.w3.org/ns/activitystreams" URL is a Mastodon-ism, AFAICT. Mastodon requires that string in the @context section. IIRC, it does not check for "https://w3id.org/security/v1" and will successfully process actor documents without it.

Non-LD consumers should probably ignore the @context section. I haven't seen any evidence that using "https://stevebate.dev/ns/activitystreams" as a peusdo content type indicator (like Mastodon does) was the intent of the recommendation authors.

jernst commented 1 month ago

So is there a weaker form of the test we should do instead, and if so, which, or none at all?

steve-bate commented 1 month ago

I’ll think about it. One option is to do JSON-LD expansion with the implicit context handling policy defined in AS2 and check for “blank node” properties that indicate they weren’t defined in any context entries. However, if the goal is to ensure Mastodon compatibility, we’d want to go ahead do the explicit context URL check.

jernst commented 1 month ago

Perfectly fine to leave this as an open issue, not everything has to be solved in the short term.