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.
This commit is contained in:
Katie Smith
2022-04-08 17:05:59 +01:00
parent f17e01c90a
commit b440f3f904
30 changed files with 67 additions and 67 deletions

View File

@@ -1,7 +1,7 @@
from app.schema_validation.definitions import uuid
get_inbound_sms_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "schema for query parameters allowed when getting list of received text messages",
"type": "object",
"properties": {
@@ -12,7 +12,7 @@ get_inbound_sms_request = {
get_inbound_sms_single_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET inbound sms schema response",
"type": "object",
"title": "GET response v2/inbound_sms",
@@ -36,7 +36,7 @@ get_inbound_sms_single_response = {
}
get_inbound_sms_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET list of inbound sms response schema",
"type": "object",
"properties": {

View File

@@ -7,7 +7,7 @@ from app.models import (
from app.schema_validation.definitions import personalisation, uuid
template = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "template schema",
"type": "object",
"title": "notification content",
@@ -20,7 +20,7 @@ template = {
}
notification_by_id = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET notification response schema",
"type": "object",
"title": "response v2/notification",
@@ -32,7 +32,7 @@ notification_by_id = {
get_notification_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET notification response schema",
"type": "object",
"title": "response v2/notification",
@@ -67,7 +67,7 @@ get_notification_response = {
}
get_notifications_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "schema for query parameters allowed when getting list of notifications",
"type": "object",
"properties": {
@@ -92,7 +92,7 @@ get_notifications_request = {
}
get_notifications_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET list of notifications response schema",
"type": "object",
"properties": {
@@ -126,7 +126,7 @@ get_notifications_response = {
}
post_sms_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST sms notification schema",
"type": "object",
"title": "POST v2/notifications/sms",
@@ -143,7 +143,7 @@ post_sms_request = {
}
sms_content = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "content schema for SMS notification response schema",
"type": "object",
"title": "notification content",
@@ -155,7 +155,7 @@ sms_content = {
}
post_sms_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST sms notification response schema",
"type": "object",
"title": "response v2/notifications/sms",
@@ -172,7 +172,7 @@ post_sms_response = {
post_email_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST email notification schema",
"type": "object",
"title": "POST v2/notifications/email",
@@ -189,7 +189,7 @@ post_email_request = {
}
email_content = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Email content for POST email notification",
"type": "object",
"title": "notification email content",
@@ -202,7 +202,7 @@ email_content = {
}
post_email_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST email notification response schema",
"type": "object",
"title": "response v2/notifications/email",
@@ -218,7 +218,7 @@ post_email_response = {
}
post_letter_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST letter notification schema",
"type": "object",
"title": "POST v2/notifications/letter",
@@ -232,7 +232,7 @@ post_letter_request = {
}
post_precompiled_letter_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST precompiled letter notification schema",
"type": "object",
"title": "POST v2/notifications/letter",
@@ -246,7 +246,7 @@ post_precompiled_letter_request = {
}
letter_content = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Letter content for POST letter notification",
"type": "object",
"title": "notification letter content",
@@ -258,7 +258,7 @@ letter_content = {
}
post_letter_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST sms notification response schema",
"type": "object",
"title": "response v2/notifications/letter",

View File

@@ -2,7 +2,7 @@ from app.models import TEMPLATE_TYPES
from app.schema_validation.definitions import personalisation, uuid
get_template_by_id_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "schema for parameters allowed when getting template by id",
"type": "object",
"properties": {
@@ -14,7 +14,7 @@ get_template_by_id_request = {
}
get_template_by_id_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET template by id schema response",
"type": "object",
"title": "reponse v2/template",
@@ -42,7 +42,7 @@ get_template_by_id_response = {
}
post_template_preview_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST template schema",
"type": "object",
"title": "POST v2/template/{id}/preview",
@@ -54,7 +54,7 @@ post_template_preview_request = {
}
post_template_preview_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST template preview schema response",
"type": "object",
"title": "reponse v2/template/{id}/preview",

View File

@@ -4,7 +4,7 @@ from app.v2.template.template_schemas import (
)
get_all_template_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "request schema for parameters allowed when getting all templates",
"type": "object",
"properties": {
@@ -14,7 +14,7 @@ get_all_template_request = {
}
get_all_template_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET response schema when getting all templates",
"type": "object",
"properties": {