mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-21 18:12:04 -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.
63 lines
1.9 KiB
Python
63 lines
1.9 KiB
Python
from app.models import INVITED_USER_STATUS_TYPES, ORGANISATION_TYPES
|
|
from app.schema_validation.definitions import uuid
|
|
|
|
post_create_organisation_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST organisation schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {"type": "string"},
|
|
"active": {"type": ["boolean", "null"]},
|
|
"crown": {"type": "boolean"},
|
|
"organisation_type": {"enum": ORGANISATION_TYPES},
|
|
},
|
|
"required": ["name", "crown", "organisation_type"]
|
|
}
|
|
|
|
post_update_organisation_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST organisation schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {"type": ["string", "null"]},
|
|
"active": {"type": ["boolean", "null"]},
|
|
"crown": {"type": ["boolean", "null"]},
|
|
"organisation_type": {"enum": ORGANISATION_TYPES},
|
|
},
|
|
"required": []
|
|
}
|
|
|
|
post_link_service_to_organisation_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST link service to organisation schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"service_id": uuid
|
|
},
|
|
"required": ["service_id"]
|
|
}
|
|
|
|
|
|
post_create_invited_org_user_status_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST create organisation invite schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"email_address": {"type": "string", "format": "email_address"},
|
|
"invited_by": uuid,
|
|
"invite_link_host": {"type": "string"}
|
|
},
|
|
"required": ["email_address", "invited_by"]
|
|
}
|
|
|
|
|
|
post_update_invited_org_user_status_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "POST update organisation invite schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {"enum": INVITED_USER_STATUS_TYPES}
|
|
},
|
|
"required": ["status"]
|
|
}
|