Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please mention the fragment identifier requirements for ActivityStreams media type #610

Open
1 of 5 tasks
SoniEx2 opened this issue Aug 3, 2024 · 12 comments
Open
1 of 5 tasks
Labels
Needs Group Input/Decision Next version Things that should probably be resolved in a next version of AS2

Comments

@SoniEx2
Copy link

SoniEx2 commented Aug 3, 2024

Please Indicate One:

  • Editorial
  • Question
  • Feedback
  • Blocking Issue
  • Non-Blocking Issue

Please Describe the Issue:

JSON-LD specifies the fragment identifier, ActivityStreams does not. if the media types are intended to be synonymous, then they should probably follow the same fragment identifier rules.

not doing so would lead to all sorts of interoperability issues.

@evanp
Copy link
Collaborator

evanp commented Aug 9, 2024

I don't think that JSON-LD actually has a mechanism for resolving parts of a JSON-LD document using fragment identifiers. We give some tips here: https://www.w3.org/wiki/ActivityPub/Primer/Object_identifiers#Fragments but it's not well-defined.

The JSON-LD spec does have a definition for referring to JSON-LD embedded with a <script> tag within an HTML document.

https://www.w3.org/TR/json-ld11/#locating-a-specific-json-ld-script-element

I don't think it's easy for ActivityPub processors (clients or servers) to reference AS2 this way, but I could see using it for embedding AS2 objects into a Web app that the local JavaScript could use. However, in this case, using the same application/ld+json type would probably be fine.

@evanp evanp added Waiting for Commenter Pending Closure Resolved Unless the issue creator protests, this will be closed in a week or two labels Aug 9, 2024
@SoniEx2
Copy link
Author

SoniEx2 commented Aug 9, 2024

you can see it defined under IANA considerations - JSON-LD 1.1, where it says:

Fragment identifiers used with application/ld+json are treated as in RDF syntaxes, as per RDF 1.1 Concepts and Abstract Syntax [RDF11-CONCEPTS].

@snarfed
Copy link

snarfed commented Aug 9, 2024

also related: w3c/activitypub#367

Lots of good ideas there, but no single obvious consensus answer, and I suspect there won't be one any time soon. It's great that JSON-LD specifies fragment handling! But that's not an answer for AP or AS2, since afaik neither of those requires (or is, strictly speaking) JSON-LD.

From the primer page:

Publishers should avoid using fragments in object identifiers for ActivityPub, because there is not a standard defined for dereferencing them.

(Obviously other fragment standards exist, as you all are discussing, so I expect the wording here means "AP itself doesn't have a standard defined.")

@SoniEx2
Copy link
Author

SoniEx2 commented Aug 9, 2024

unfortunately, if you're using application/ld+json; profile="https://www.w3.org/ns/activitystreams" (instead of application/activity+json), then you're using JSON-LD. thus, if they're supposed to be synonymous... it would be unfortunate to handle them differently.

@snarfed
Copy link

snarfed commented Aug 9, 2024

Maybe! That's a big if, since much of the fediverse is on application/activity+json. AS2 clearly isn't JSON-LD, and AP is also clear that it can be JSON-LD compatible, but doesn't have to be. (@evanp correct me if I'm wrong!)

Mime types are useful! But it seems like a bit of a stretch to say that they'd mandate that much expectation (requirement) of behavior here.

@SoniEx2
Copy link
Author

SoniEx2 commented Aug 9, 2024

it might be useful to raise this issue on art@ietf or thereabouts, then. they probably know more about this stuff than we do.

@csarven
Copy link
Member

csarven commented Aug 9, 2024

Whether "much" of the "fediverse" is "on" (or off) JSON-LD is not relevant to this issue. AFAICT, "much" of the AP-verse is using fragment identifiers in application/activity+json representations.

As there is publicly verifiable deployment out there, the editorial (or other) feedback requested in this issue is I think fairly valid.

Moreover, "much" of the AP-verse appears to use JSON-LD and finds it compatible (as per AP and AS Core). Anecdotal evidence from a server using the Mastodon implementation FWIW :

$ curl -iLH'Accept: application/ld+json' https://w3c.social/users/csarven
HTTP/2 200 
server: nginx/1.18.0
date: Fri, 09 Aug 2024 17:48:19 GMT
content-type: application/activity+json; charset=utf-8

...

{"@context":["https://www.w3.org/ns/activitystreams"...

Successful response including JSON-LD context. Equivalent representation (content-type, content-length, etag..) with identical JSON-LD content at:

$ curl -iLH'Accept: application/activity+json' https://w3c.social/users/csarven

@evanp
Copy link
Collaborator

evanp commented Aug 16, 2024

I guess we have two options here. Since application/activity+json is a synonym for ld+json, we can defer to the jsonld spec implicitly. however, it seems like a fair expectation to define this fragment syntax explicitly.

@evanp evanp added Next version Things that should probably be resolved in a next version of AS2 Needs Group Input/Decision and removed Waiting for Commenter Pending Closure Resolved Unless the issue creator protests, this will be closed in a week or two labels Aug 16, 2024
@evanp
Copy link
Collaborator

evanp commented Aug 16, 2024

Specifically, we should add a section on Fragment Identifier Requirements. i think we have a choice between following jsonld requirements, eg no meaning except identity, or adding a way to look up a property of the resource.

@evanp
Copy link
Collaborator

evanp commented Aug 16, 2024

@snarfed
Copy link

snarfed commented Aug 16, 2024

Sounds like this issue is evolving into more or less the same question as w3c/activitypub#367 ? I'm happy to merge them if so.

...oh, they're re the two different specs. OK. Even so, might be worth addressing them together, and then afterward deciding which language to add to which spec, or errata, or primers, etc.

@csarven
Copy link
Member

csarven commented Aug 17, 2024

AP servers and clients conform to RFC 7231 and RFC 3986/3987, so by definition, they can work with fragment identifiers when necessary.

Any software generating or consuming content using AS2 is expected to understand "anyURI" (which optionally includes fragment identifiers).

AP and AS2 already have strong compatibility with JSON-LD, so I believe deferring to JSON-LD for fragment identifiers will maintain that alignment without introducing any additional constraints or definitions.


Aside:

AS2 also doesn't constrain the URI scheme for the id property.

Servers have always had the right, and can still impose their own constraints on a request target by rejecting the request with a 422 status code when they consider any part of the content to be semantically erroneous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Group Input/Decision Next version Things that should probably be resolved in a next version of AS2
Projects
None yet
Development

No branches or pull requests

4 participants