Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default value for -l and -s options seems to be wrong #22

Open
VladimirAlexiev opened this issue Jun 23, 2023 · 0 comments
Open

default value for -l and -s options seems to be wrong #22

VladimirAlexiev opened this issue Jun 23, 2023 · 0 comments

Comments

@VladimirAlexiev
Copy link

According to online help, the lint and safe options are turned off by default:

# jsonld canonize -h
Options:
  -l, --lint             show lint warnings [false]
  -s, --safe             enable safe mode [false]

I have a file with a couple of defects:

# cat input.jsonld
{
  "@context": {
    "@vocab": "http://schema.org/",
    "countries": "http://publication.europa.eu/resource/authority/country/"
  },
  "@graph": [
    {
      "@id": "countries:ITA"
    },
    {
      "@id": "http://people.example/Homer",
      "full_name": "Homer Simpson",
      "country": {
        "@id": "countries:ITA"
      }
    },
    {
      "@id": "http://people.example/Lisa",
      "full_name": "Lisa Simpson",
      "country": {
        "@id": "countries:ITA"
      }
    }
  ]
}

If I feed it to canonize, it complains about both "safe" and "lint", there's no way to disable those checks, and it produces no output:

# jsonld canonize input.jsonld
jsonld.ValidationError: Safe mode validation error.
    at safeEventHandler (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\events.js:133:11)
    at _handle (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\events.js:82:7)
    at api.handleEvent (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\events.js:71:3)
    at _dropUnsafeObject (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\expand.js:415:7)
    at Object.api.expand (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\expand.js:381:12)
    at async Object.api.expand (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\expand.js:125:15)
    at async _expandObject (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\expand.js:920:25)
    at async api.expand (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\expand.js:251:3)
    at async Function.jsonld.expand (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\jsonld.js:321:18)
    at async Function.jsonld.toRDF (C:\Users\Vladimir Alexiev\AppData\Roaming\npm\node_modules\jsonld-cli\node_modules\jsonld\lib\jsonld.js:680:16)
Error: {
  name: 'jsonld.ValidationError',
  details: {
    event: {
      type: [ 'JsonLdEvent' ],
      code: 'object with only @id',
      level: 'warning',
      message: 'Dropping object with only @id.',
      details: {
        value: {
          '@id': 'http://publication.europa.eu/resource/authority/country/ITA'
        }
      }
    }
  }
}

The other modes (expand, flatten, format) don't issues such errors/warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant