atlassian / atlassian/better-ajv-errors

Confusing error message while using `minItems`

Open
#171 1 comment 0 reactions 1 assignee Claimed by @dmiller113 View on GitHub
enhancement
Dominant language
JavaScript
Stars
245
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I could be using this wrong but I'm validating a schema that has `minItems: 1` in it like this:
```javascript
{
operators: {
type: 'array',
minItems: 1,
items: {...}
}
}
```

and it's leading to an awkward error message like this: `/operators: minItems must NOT have fewer than 1 items` when ideally it would be more like `/operators: must NOT have fewer than 1 items`

It looks like thats due to how `DefaultValidationError` => `getError()` is putting a `keyword` in front of the message but in this case the keyword is making the error more confusing and less human readable.

Let me know if there is something I'm missing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.