Skip to content

lint does not pick up relative object reference issues which toRdf does #570

@absoludity

Description

@absoludity

@VladimirAlexiev created an issue (uncefact/spec-untp#369) for a validation problem he's encountering when validating some automatically generated sample data we provide (untp-dpp-instance-0.6.0-beta12.json.

I thought this odd since we lint our data with jsonld lint --safe, but it turns out the lint sub-command doesn't pick up all the errors (or I'm misunderstanding what lint is meant to do):

$ jsonld lint --safe untp-dpp-instance-0.6.0-beta12.json 

$ echo $?
0

If I instead use jsonld to convert to RDF, I see the exact error which Vladimir reports:

$ jsonld toRdf --safe untp-dpp-instance-0.6.0-beta12.json 
jsonld.ValidationError: Safe mode validation error.
    at safeEventHandler (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/events.js:135:11)
    at _handle (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/events.js:82:7)
    at api.handleEvent (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/events.js:71:3)
    at _objectToRDF (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/toRdf.js:389:7)
    at _graphToRDF (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/toRdf.js:194:24)
    at api.toRDF (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/toRdf.js:90:5)
    at jsonld.toRDF (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/jsonld.js:691:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.toRdf (file:///home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/bin/jsonld.js:402:20)
    at async Command.parseAsync (/home/michael/.nvm/versions/node/v20.13.1/lib/node_modules/jsonld-cli/node_modules/commander/lib/command.js:936:5)
Error: {
  name: 'jsonld.ValidationError',
  details: {
    event: {
      type: [ 'JsonLdEvent' ],
      code: 'relative object reference',
      level: 'warning',
      message: 'Relative object reference found.',
      details: {
        object: 'https://vocabulary.uncefact.org/CountryIdEnumeration Value'
      }
    }
  }
}

$ echo $?
1

Is there a reason this error isn't reported during lint?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions