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

@@ -2,7 +2,7 @@ import os
import jsonschema
from flask import json
from jsonschema import Draft4Validator
from jsonschema import Draft7Validator
def return_json_from_response(response):
@@ -22,5 +22,5 @@ def validate_v0(json_to_validate, schema_filename):
def validate(json_to_validate, schema):
validator = Draft4Validator(schema)
validator = Draft7Validator(schema)
validator.validate(json_to_validate, schema)

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET notification return schema - for email notifications",
"type" : "object",
"properties": {

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET notification return schema - for sms notifications",
"type" : "object",
"properties": {

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "GET notification return schema - for sms notifications",
"type" : "object",
"properties": {

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST notification return schema - for email notifications",
"type" : "object",
"properties": {

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST notification return schema - for sms notifications",
"type" : "object",
"properties": {

View File

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Common definitions - usage example: {'$ref': 'definitions.json#/uuid'} (swap quotes for double quotes)",
"uuid": {
"type": "string",