validation - Set default rules for type using AJV -
i'm trying figure out how can globally arrays must of length 1 without having use minitems: 1 every place in schema specify array. looking @ creating custom type , option feel there should better way?
another global limitation not allowing empty strings.
thanks help!
you can never change behavior of keyword (globally or otherwise). best bet create file includes special rules.
global.js
{ "definitions": { "non-empty-array": { "type": "array", "minitems": 1 } } }
then can reference file time want use special rules.
example.js
{ "type": "object", "properties": { "a": { "allof": [{ "$ref": "/global.js#/definitions/non-empty-array" }], "items": { "type": "string" } }, "b": { "allof": [{ "$ref": "global.js#/definitions/non-empty-array" }], "items": { "type": "integer" } } } }
Comments
Post a Comment