Last active
August 26, 2022 23:26
-
-
Save Zegnat/11eb8c0b3f23dae20c380d296564d5ae to your computer and use it in GitHub Desktop.
JSON Schema for validating JSON representations of Kendo filters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http:\/\/json-schema.org\/draft-04\/schema#", | |
"definitions": { | |
"filter": { | |
"oneOf": [ | |
{ | |
"type": "object", | |
"properties": { | |
"field": { | |
"type": "string", | |
"minLength": 1 | |
}, | |
"operator": { | |
"enum": [ | |
"eq", | |
"neq", | |
"lt", | |
"lte", | |
"gt", | |
"gte", | |
"startswith", | |
"endswith", | |
"contains" | |
] | |
}, | |
"value": { | |
"type": [ | |
"string", | |
"number" | |
] | |
} | |
}, | |
"required": [ | |
"field", | |
"operator", | |
"value" | |
], | |
"additionalProperties": false | |
}, | |
{ | |
"type": "object", | |
"properties": { | |
"field": { | |
"type": "string", | |
"minLength": 1 | |
}, | |
"operator": { | |
"enum": [ | |
"isnull", | |
"isnotnull", | |
"isempty", | |
"isnotempty" | |
] | |
} | |
}, | |
"required": [ | |
"field", | |
"operator" | |
], | |
"additionalProperties": false | |
} | |
] | |
}, | |
"combinator": { | |
"type": "object", | |
"properties": { | |
"logic": { | |
"enum": [ | |
"and", | |
"or" | |
] | |
}, | |
"filters": { | |
"type": "array", | |
"items": { | |
"anyOf": [ | |
{ | |
"$ref": "#\/definitions\/filter" | |
}, | |
{ | |
"$ref": "#\/definitions\/combinator" | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"logic", | |
"filters" | |
], | |
"additionalProperties": false | |
} | |
}, | |
"oneOf": [ | |
{ | |
"$ref": "#\/definitions\/filter" | |
}, | |
{ | |
"$ref": "#\/definitions\/combinator" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment