Created
February 16, 2023 22:57
-
-
Save gyli/8882cc62356b1c5d0c02e656f1a0927a to your computer and use it in GitHub Desktop.
Meta-schema of a jsonschema to disallow Python dictionary method names to be used as property names
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-07/schema#", | |
"title": "Meta-schema of a jsonschema to disallow Python dictionary method names to be used as property names", | |
"description": "Checks forbidden properties in json objects recursively. Jsonschema keywords need to be conditionally excluded.", | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/definitions/forbidden-properties" | |
} | |
], | |
"definitions": { | |
"forbidden-properties": { | |
"$coment": "Python dictionary method names are disallowed", | |
"properties": { | |
"clear": false, | |
"copy": false, | |
"fromkeys": false, | |
"get": false, | |
"keys": false, | |
"pop": false, | |
"popitem": false, | |
"setdefault": false, | |
"update": false, | |
"values": false | |
}, | |
"anyOf": [ | |
{ | |
"$comment": "items is a jsonschema keyword when type == array", | |
"properties": { | |
"type": { | |
"const": "array" | |
} | |
} | |
}, | |
{ | |
"properties": { | |
"items": false | |
} | |
} | |
], | |
"additionalProperties": { | |
"$ref": "#/definitions/forbidden-properties" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment