How to constraint maximum length of keys of an object in JSON schema?

44 views
Skip to first unread message

Ilya Kulakov

unread,
Mar 25, 2016, 3:35:35 PM3/25/16
to JSON Schema
I would like to constraint maximum length of a key of the property which type is object. All of its values are generated in runtime and I'd like to spot a misbehavior as soon as possible by validating document before further processing.

Austin Wright

unread,
Apr 4, 2016, 5:08:41 AM4/4/16
to JSON Schema
I don't know if there's a keyword that will actually accomplish this, but it seems like a reasonable one to include.

There might still be some non-standard way you can specify this as a guideline to your particular JSON Schema validator, though.

Ilya Kulakov

unread,
Apr 4, 2016, 11:13:38 AM4/4/16
to JSON Schema
Austin,

I was suggested to use patternProperties with a matter that limits the length.
While this will work, I believe it's not the most efficient approach.

понедельник, 4 апреля 2016 г., 5:08:41 UTC-4 пользователь Austin Wright написал:
Reply all
Reply to author
Forward
0 new messages