mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-24 18:09:41 -04: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.
70 lines
1.9 KiB
Python
70 lines
1.9 KiB
Python
from app.schema_validation.definitions import uuid
|
|
|
|
get_inbound_sms_request = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "schema for query parameters allowed when getting list of received text messages",
|
|
"type": "object",
|
|
"properties": {
|
|
"older_than": uuid,
|
|
},
|
|
"additionalProperties": False,
|
|
}
|
|
|
|
|
|
get_inbound_sms_single_response = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "GET inbound sms schema response",
|
|
"type": "object",
|
|
"title": "GET response v2/inbound_sms",
|
|
"properties": {
|
|
"user_number": {"type": "string"},
|
|
"created_at": {
|
|
"format": "date-time",
|
|
"type": "string",
|
|
"description": "Date+time created at"
|
|
},
|
|
"service_id": uuid,
|
|
"id": uuid,
|
|
"notify_number": {"type": "string"},
|
|
"content": {"type": "string"},
|
|
},
|
|
"required": [
|
|
"id", "user_number", "created_at", "service_id",
|
|
"notify_number", "content"
|
|
],
|
|
"additionalProperties": False,
|
|
}
|
|
|
|
get_inbound_sms_response = {
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "GET list of inbound sms response schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"received_text_messages": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/inbound_sms"
|
|
}
|
|
},
|
|
"links": {
|
|
"type": "object",
|
|
"properties": {
|
|
"current": {
|
|
"type": "string"
|
|
},
|
|
"next": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": False,
|
|
"required": ["current"]
|
|
}
|
|
},
|
|
"required": ["received_text_messages", "links"],
|
|
"definitions": {
|
|
"inbound_sms": get_inbound_sms_single_response
|
|
},
|
|
"additionalProperties": False,
|
|
}
|