Skip to content

Invalid predicate IRI for key in JSON field #90

Open
@adlerfaulkner

Description

@adlerfaulkner

When wrapping a nested json field in @value like YargsCliExtractor:_parameters below:

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^3.0.0/components/context.jsonld",
  "@graph": [
    {
      "@id": "urn:solid-server-app-setup:default:CliExtractor",
      "@type": "YargsCliExtractor",
      "YargsCliExtractor:_options": {
        "@type": "@json",
        "@value": {
          "usage": "node ./bin/server.js [args]"
        }
      },
      "YargsCliExtractor:_parameters": {
        "@type": "@json",
        "@value": {
          "config": {
            "alias": "c",
            "requiresArg": true,
            "type": "string",
            "describe": "The configuration for the server. The default only stores data in memory; to persist to your filesystem, use @css:config/file.json."
          },
        ...

I get an error saying Invalid predicate IRI: config (full error below). I'm not sure why it works for YargsCliExtractor:_options but not YargsCliExtractor:_parameters. That seems to mean that it has something to do with the nested json within config.

Full trace:

Could not build the config files from /Users/adlerfaulkner/standard-knowledge-data-store/config/config.json
Cause: Error while parsing file "/Users/adlerfaulkner/community-server/config/app/variables/cli/cli.json": Invalid predicate IRI: config
Error: Error while parsing file "/Users/adlerfaulkner/community-server/config/app/variables/cli/cli.json": Invalid predicate IRI: config
    at Function.addPathToError (/Users/adlerfaulkner/community-server/node_modules/componentsjs/lib/rdf/RdfParser.js:73:16)
    at PassThrough.<anonymous> (/Users/adlerfaulkner/community-server/node_modules/componentsjs/lib/rdf/RdfParser.js:46:38)
    at PassThrough.emit (node:events:532:35)
    at JsonLdParser.<anonymous> (/Users/adlerfaulkner/community-server/node_modules/rdf-parse/lib/RdfParser.js:71:47)
    at JsonLdParser.emit (node:events:532:35)
    at ParsingContext.emitError (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/ParsingContext.js:232:21)
    at Util.predicateToTerm (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/Util.js:438:37)
    at EntryHandlerPredicate.validate (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js:90:71)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async JsonLdParser.validateKey (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/JsonLdParser.js:320:17)
    at async JsonLdParser.newOnValueJob (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/JsonLdParser.js:174:62)
    at async JsonLdParser.executeBufferedJobs (/Users/adlerfaulkner/community-server/node_modules/jsonld-streaming-parser/lib/JsonLdParser.js:434:13)

If I remove all of the fields inside config so that it's just config: {} the error goes away.

The problem also seems to be fixed If I put YargsCliExtractor:_parameters and it's json type into the @context like this:

{
  "@context": [
    "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^3.0.0/components/context.jsonld",
    { "parameters": { "@id": "YargsCliExtractor:_parameters", "@type": "@json" } }
  ],
  "@graph": [
    {
      "comment": "Extracts CLI arguments into a key/value object. Config and mainModulePath are only defined here so their description is returned.",
      "@id": "urn:solid-server-app-setup:default:CliExtractor",
      "@type": "YargsCliExtractor",
      "YargsCliExtractor:_options": {
        "@type": "@json",
        "@value": {
          "usage": "node ./bin/server.js [args]"
        }
      },
      "parameters": {
        "config": {
          "alias": "c",
          "requiresArg": true,
          "type": "string",
          "describe": "The configuration for the server. The default only stores data in memory; to persist to your filesystem, use @css:config/file.json."
        },
        ...

I am on version 2.4.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions