ajv-cli icon indicating copy to clipboard operation
ajv-cli copied to clipboard

ajv-cli dies when evaluating yaml with duplicate object keys

Open Qstick opened this issue 3 years ago • 1 comments

When running on yml with duplicate object keys, ajv fails and errors out with the following error. Let me know if this is something I'm missing on my side?

Command

ajv validate -d "definitions/v3/*.yml" -s "definitions/v3/schema.json" --verbose 

Error:

error:  Invalid left-hand side expression in prefix operation

Example Yaml

---
id: example
name: Example

caps:
  date: pass
  date: other

Version: 5.0.0 (installed via npm) Scemas: Tested with a draft07 and draft2020

Qstick avatar Jun 19 '22 19:06 Qstick

A bit more info on the full stack trace

SyntaxError: Invalid left-hand side expression in prefix operation
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at openFile (C:\Users\qstic\source\repos\ajv-cli\dist\commands\util.js:56:20)
    at validateDataFile (C:\Users\qstic\source\repos\ajv-cli\dist\commands\validate.js:37:42)

Qstick avatar Jun 19 '22 20:06 Qstick