Closed ptsefton closed 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):
isURL(id)
) then use as is (isURL comes from https://github.com/validatorjs/validator.js and by default it validates to true for http, https and ftp).id === ./
use as isid starts with #
use as isI 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.
So reading that json-ld page suggests it should be something like:
The second case covers the first
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.