Files
notifications-api/app/v2/templates/templates_schemas.py
Katie Smith b440f3f904 Use Draft-07 and Draft7Validator everywhere
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.
2022-04-14 14:46:10 +01:00

34 lines
912 B
Python

from app.models import TEMPLATE_TYPES
from app.v2.template.template_schemas import (
get_template_by_id_response as template,
)
get_all_template_request = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "request schema for parameters allowed when getting all templates",
"type": "object",
"properties": {
"type": {"enum": TEMPLATE_TYPES}
},
"additionalProperties": False,
}
get_all_template_response = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET response schema when getting all templates",
"type": "object",
"properties": {
"templates": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/template"
}
}
},
"required": ["templates"],
"definitions": {
"template": template
}
}