mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 16:31:15 -05:00
Replace marshmallow with jsonschema
Created a new schema that accepts request parameters for the get_notifications v2 route. Using that to validate now instead of the marshmallow validation. Also changed the way formatted error messages are returned because the previous way was cutting off our failing `enum` messages.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from app.models import NOTIFICATION_STATUS_TYPES, TEMPLATE_TYPES
|
||||
from app.schema_validation.definitions import (uuid, personalisation)
|
||||
|
||||
# this may belong in a templates module
|
||||
@@ -72,6 +73,28 @@ get_notification_response = {
|
||||
]
|
||||
}
|
||||
|
||||
get_notifications_request = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "schema for query parameters allowed when getting list of notifications",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": NOTIFICATION_STATUS_TYPES
|
||||
}
|
||||
},
|
||||
"template_type": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": TEMPLATE_TYPES
|
||||
}
|
||||
},
|
||||
"older_than": uuid
|
||||
},
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
get_notifications_response = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "GET list of notifications response schema",
|
||||
|
||||
Reference in New Issue
Block a user