mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
The XML for an alerts requires a `<description>` field. The XML for a `<cancel>` may have a `<description>` field populated (although we ignore the contents) but it may also be empty. This commit updates the schema to leave the all the validation to the view layer, which can decide when or when not to validate the content of the `<description>` field.
124 lines
2.9 KiB
Python
124 lines
2.9 KiB
Python
post_broadcast_schema = {
|
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
"type": "object",
|
|
"required": [
|
|
"msgType",
|
|
"reference",
|
|
"cap_event",
|
|
"category",
|
|
"content",
|
|
"areas",
|
|
],
|
|
"additionalProperties": False,
|
|
"properties": {
|
|
"reference": {
|
|
"type": [
|
|
"string",
|
|
"null",
|
|
],
|
|
},
|
|
"references": {
|
|
"type": [
|
|
"string",
|
|
"null",
|
|
],
|
|
},
|
|
"cap_event": {
|
|
"type": [
|
|
"string",
|
|
"null",
|
|
],
|
|
},
|
|
"category": {
|
|
"type": "string",
|
|
"enum": [
|
|
"Geo",
|
|
"Met",
|
|
"Safety",
|
|
"Security",
|
|
"Rescue",
|
|
"Fire",
|
|
"Health",
|
|
"Env",
|
|
"Transport",
|
|
"Infra",
|
|
"CBRNE",
|
|
"Other",
|
|
],
|
|
},
|
|
"expires": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
},
|
|
"content": {
|
|
"type": "string",
|
|
"minLength": 0,
|
|
},
|
|
"web": {
|
|
"type": "string",
|
|
"format": "uri",
|
|
},
|
|
"areas": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"$ref": "#/definitions/area",
|
|
},
|
|
},
|
|
"msgType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"Alert",
|
|
"Cancel",
|
|
# The following are valid CAP but not supported by our
|
|
# API at the moment
|
|
# "Update",
|
|
# "Ack",
|
|
# "Error",
|
|
],
|
|
}
|
|
},
|
|
"definitions": {
|
|
"area": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"polygons",
|
|
],
|
|
"additionalProperties": False,
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"pattern": "([a-zA-Z1-9]+ )*[a-zA-Z1-9]+",
|
|
},
|
|
"polygons": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"oneOf": [
|
|
{
|
|
"$ref": "#/definitions/polygon",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"polygon": {
|
|
"type": "array",
|
|
"minItems": 4,
|
|
"items": {
|
|
"$ref": "#/definitions/coordinatePair",
|
|
},
|
|
},
|
|
"coordinatePair": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number"
|
|
},
|
|
"minItems": 2,
|
|
"maxItems": 2,
|
|
},
|
|
},
|
|
}
|