mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
We were using the Draft4Validator in one place, so this updates it to the Draft7Validator instead. The schemas were mostly using draft 4 of the JSON schema, though there were a couple of schemas that were already of version 7. This updates them all to version 7, which is the latest version fully supported by the jsonschema Python package. There are some breaking changes in the newer version of the schema, but I could not see anywhere would these affect us. Some of these schemas were not valid in version 4, but are now valid in version 7 because `"required": []` was not valid in earlier versions.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from app.schema_validation.definitions import nullable_uuid, uuid
|
|
|
|
post_create_template_folder_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST schema for getting template_folder",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {"type": "string", "minLength": 1},
|
|
"parent_id": nullable_uuid
|
|
},
|
|
"required": ["name", "parent_id"]
|
|
}
|
|
|
|
post_update_template_folder_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST schema for updating template_folder",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {"type": "string", "minLength": 1},
|
|
"users_with_permission": {"type": "array", "items": uuid}
|
|
},
|
|
"required": ["name"]
|
|
}
|
|
|
|
post_move_template_folder_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST schema for renaming template_folder",
|
|
"type": "object",
|
|
"properties": {
|
|
"templates": {"type": "array", "items": uuid},
|
|
"folders": {"type": "array", "items": uuid},
|
|
},
|
|
"required": ["templates", "folders"]
|
|
}
|