Arkisto-Platform / describo-online

https://describo.github.io
GNU General Public License v3.0
7 stars 2 forks source link

Allow ARCPs as IDs and do not add a # #39

Closed ptsefton closed 2 years ago

ptsefton commented 2 years ago

If you change an item's ID to something that uses the arcp:// URI scheme it gets prepended with a # -- maybe this should be coded to comply with the JSON-LD spec so there are no surprises later.

If the node object contains the @id key, its value MUST be an absolute IRI, a relative IRI, or a compact IRI (including blank node identifiers). See § 3.3 Node Identifiers, § 4.4 Compact IRIs, and § 4.16 Identifying Blank Nodes for further discussion on @id values. Source: https://json-ld.org/spec/latest/json-ld/#node-objects

marcolarosa commented 2 years ago

Ahh, I hadn't considered that!

The code currently is quite simple (https://github.com/Arkisto-Platform/describo-online/blob/master/api/src/lib/crate.js#L528-L530):

I can pass a protocols list to isURL (http, https, ftp, file, arcp) which means we can control what is a url or not but also means we need a new release if we need to add a protocol. Or, it can be a regex like ^[a-z,A-Z]+\:\/\/.* (basically [anything]://[anything])`.

It also (currently) doesn't support id's starting with '/'. So i'm thinking we add protocols list to isURL and I also check that id's starting with './' or '/' are used as is.

marcolarosa commented 2 years ago

So reading that json-ld page suggests it should be something like:

ptsefton commented 2 years ago

The second case covers the first