Skip to content

Commit

Permalink
Add user-friendly message for maxLength validation
Browse files Browse the repository at this point in the history
"should not have fewer than 5 items" feels weird for a string of characters. I think we should revert back to v6 terminology and say "characters" instead of "items".
  • Loading branch information
nicksrandall committed Dec 16, 2020
1 parent cd7c6a8 commit b68927a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vocabularies/validation/limitLength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ucs2length from "../../compile/ucs2length"
const error: KeywordErrorDefinition = {
message({keyword, schemaCode}) {
const comp = keyword === "maxLength" ? "more" : "fewer"
return str`should NOT have ${comp} than ${schemaCode} items`
return str`should NOT have ${comp} than ${schemaCode} characters`
},
params: ({schemaCode}) => _`{limit: ${schemaCode}}`,
}
Expand Down

0 comments on commit b68927a

Please sign in to comment.