Description
(resubmitting from here)
It might be useful to be able to set limits on property names when defining them with patternProperties
.
For example, I have an object which should have arbitrary key-value pairs, and I want to constrain the keys to be at most 64 characters. For now, I've resorted to this:
"additionalProperties": false,
"patternProperties": {
"^\\S{1,64}$" : { ... }
}
(resubmitting this, from [here|https://github.com/json-schema/json-schema/issues/193#issuecomment-255453173])
However, the error message generated is very confusing. For example, if I send this object:
{ "SIXTYFOURCHARACTERSYOUSAYWELLALRIGHTTHENLETSNOTEXCEEDTHATSHALLWEIMEANWHONEEDSMORETHANSIXTYFOURCHARACTERSANYWAY":"value"}
I get the following error, which is clear to someone familiar with JSON-schema and the additional properties keyword, but not to everyone else:
SIXTYFOURCHARACTERSYOUSAYWELLALRIGHTTHENLETSNOTEXCEEDTHATSHALLWEIMEANWHONEEDSMORETHANSIXTYFOURCHARACTERSANYWAY: Additional properties not allowed
I suggest support for something like:
"patternProperties": {
"^\\S*$": {
"maxLength": 64,
...
}
}
With the corresponding error message:
SIXTYFOURCHARACTERSYOUSAYWELLALRIGHTTHENLETSNOTEXCEEDTHATSHALLWEIMEANWHONEEDSMORETHANSIXTYFOURCHARACTERSANYWAY: Property name is too long (110 chars), maximum 64