ajv-validator / ajv-cli

Command-line interface for Ajv JSON Validator
https://ajv.js.org
MIT License
261 stars 66 forks source link

"error: schema is invalid: data/properties/required must be object,boolean" does not give line number #219

Open claybridges opened 2 years ago

claybridges commented 2 years ago

None of --error options help. I'm not even sure what the actual error is, but a line number would really help.

See also #34 , #111 .

It's possible that json-source-map can be used to figure this out somehow (see here), but I don't know the exact steps. Moreover, needing to jump through additional hoops makes this tool borderline useless to me.

Perhaps adding this functionality to the tool would be possible? For instance, see (at time of this writing, year-old) PR https://github.com/ajv-validator/ajv-cli/pull/189#issue-980783689.

sreerammeka commented 1 year ago

I'm also receiving this error with this ajv-validator.

The error is below:

Error: schema is invalid: data.properties['custom'].properties['enterprise'].properties['logAccessIamRole'] should be object,boolean

@claybridges Is this a similar error you are receiving?

claybridges commented 1 year ago

@claybridges Is this a similar error you are receiving?

Looks pretty similar.

rap1ds commented 7 months ago

Got the exact same error: schema is invalid: data/properties/required must be object,boolean

The reason for me was that I had misplaced the required key in my schema.

So instead of having:

{
  "properties": {
    "address": {
      "type": "string"
    }
  },
  "required": ["address"]
}

...I had this:

{
  "properties": {
    "address": {
      "type": "string"
    },
    "required": ["address"]
  },
}

And after I spotted the error, the error message makes totally sense.

ckeshava commented 1 month ago

@rap1ds thank you so much, your suggestion helped me a lot. I wish the error message were half as helpful as your answer