ajv-validator / ajv-validator/ajv

Better error messaging for NOT

Open
#2,255 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
14.8k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

**What version of Ajv you are you using?**
8.11.0

**What problem do you want to solve?**
I have a schema with a `not` clause which, on failure, returns a very unhelpful/confusing message: `my-schema.json/thing must NOT be valid`

```json
"thing": {
"type": "number",
"not": {
"exclusiveMinimum": -0.25,
"exclusiveMaximum": 0.25
}
}
```

**What do you think is the correct solution to problem?**
I think the correct messaging would be something along the line of what it would say if the criteria was not wrapped in a `not`. Something like:
```
my-schema.json/thing must NOT be < 0.25, my-schema.json/thing must NOT be > -0.25
```

**Will you be able to implement it?**
Unsure

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.