eyereasoner / KoreografeyeDemo

Demonstrations for the Koreografeye project
0 stars 1 forks source link

JSON-LD context not resolving with `0.0.0` version #2

Open sneakers-the-rat opened 6 months ago

sneakers-the-rat commented 6 months ago

This context line: https://github.com/eyereasoner/KoreografeyeDemo/blob/b7d02c591fdaf2e0e7eb031d55868b75b90f6045/config.jsonld#L4

causes an error:

2024-01-08T19:27:47.982Z [Components.js] warn: Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/koreografeye-mastodon/^0.0.0/components/context.jsonld' in ./config.jsonld. This may indicate a missing or invalid dependency, incorrect version number, or an invalid context URL.
/Users/jonny/git/KoreografeyeDemo/node_modules/componentsjs/lib/rdf/RdfParser.js:85
        return new Error(`Error while parsing file "${path}": ${error.message}`);
               ^

Error: Error while parsing file "./config.jsonld": Failed to load remote context https://linkedsoftwaredependencies.org/bundles/npm/koreografeye-mastodon/^0.0.0/components/context.jsonld: Internal Server Error

Setting it as "https://linkedsoftwaredependencies.org/bundles/npm/koreografeye/^0.4.6/components/context.jsonld", fixes the problem, but you might even just want to to >0.0.0 which presumably would resolve (didn't test)

phochste commented 6 months ago

The context line is correct: all it matches all 0.x.x versions of koreografeye. I don't know what caused the problem at your end. This investigating if I can replicate it.

sneakers-the-rat commented 6 months ago

According tonode-semver docs:

Allows changes that do not modify the left-most non-zero element in the [major, minor, patch] tuple. In other words, this allows patch and minor updates for versions 1.0.0 and above, patch updates for versions 0.X >=0.1.0, and no updates for versions 0.0.X.

So ^0.0.0 matches nothing -

But also:

A missing minor and patch values will desugar to zero, but also allow flexibility within those values, even if the major version is zero.

^1.x := >=1.0.0 <2.0.0-0
^0.x := >=0.0.0 <1.0.0-0

So if you want >=0.0.0,<1.0.0 (==0.x.x) then that should be ^0.x

Confirmed with their semver calculator: ^0.0.0 matches nothing, but all these work:

phochste commented 6 months ago

Ok got it. It is a node version issue. I can get the same errors when using the node version you mentioned in the KoreografyePlugin ticket. I'll look into it!

sneakers-the-rat commented 6 months ago

Not trying to make a big deal out of this, ultimately I don't really care, just thought i'd give a nod and say hey, so up to you.

i'm just about to log off for the night, but if i go to the website in my browser i get a failure to resolve: https://linkedsoftwaredependencies.org/bundles/npm/koreografeye/%5E0.0.0/components/context.jsonld

but these all work just fine:

Not sure if node handles the error differently in different versions, but i'm telling ya that ^0.0.0 can only ever be satisfied by v0.0.0 - since there are no non-zero elements, the only valid match is a version that does not modify any numbers. don't take my word for it, check out that calculator from NPM i linked above.

If what you intended to do was match 0.x.x (>=0.0.0, <1.0.0) then any of the above three version specifiers do that, should just be a simple find and replace ;)