Skip to content

Using @base with a DID causes truncation of prefix in the playground (after the first colon?) #849

Open
@trwnh

Description

@trwnh

In playing around with w3c/json-ld-syntax#446 (i.e. where @type is not an IRI), I discovered that the playground will take this:

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    {"@base": "did:plc:ewvi7nxzyoun6zhxrhs64oiz"}
  ],
  "id": "did:plc:ewvi7nxzyoun6zhxrhs64oiz",
  "service": [
    {
      "id": "#atproto_pds",
      "serviceEndpoint": "https://enoki.us-east.host.bsky.network",
      "type": "AtprotoPersonalDataServer"
    }
  ]
}

and canonize it as this:

<did:plc:ewvi7nxzyoun6zhxrhs64oiz#atproto_pds> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <did:AtprotoPersonalDataServer> .
<did:plc:ewvi7nxzyoun6zhxrhs64oiz#atproto_pds> <https://www.w3.org/ns/did#serviceEndpoint> <https://enoki.us-east.host.bsky.network> .
<did:plc:ewvi7nxzyoun6zhxrhs64oiz> <https://www.w3.org/ns/did#service> <did:plc:ewvi7nxzyoun6zhxrhs64oiz#atproto_pds> .

Note that <did:AtprotoPersonalDataServer> is being emitted as the canonization of AtprotoPersonalDataServer which is incorrect.

Tangentially, taking out the @base from the @context and absolutizing the service.id in some other way (like prefixing it with a URI) will cause the processor to emit a warning about a "relative @type reference".

Also tangentially, taking out the @base from the @context and also taking out the # from the id atproto_pds will exhibit similar behavior -- <did:atproto_pds> is emitted as the object of the quad.

{"@base": "did:plc:ewvi7nxzyoun6zhxrhs64oiz"} will do this, but {"@base": "did:plc:ewvi7nxzyoun6zhxrhs64oiz#"} will also do the same thing.

In short, the playground is behaving as if I am declaring {"@base": "did:"}; the base IRI is seemingly truncated after the first colon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions