diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index 0de8ae78f..f25e04d43 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -827,30 +827,51 @@ class SuperUserMessages(ApiResource): """ Resource for getting a list of super user messages """ schemas = { - 'messages': { - 'id': 'messages', + 'GetMessage': { + 'id': 'GetMessage', 'type': 'object', 'description': 'Messages that a super user has saved in the past', + 'properties': { + 'message': { + 'type': 'array', + 'description': 'A list of messages', + 'itemType': { + 'type': 'object', + 'properties': { + 'id': { + 'type': 'integer', + 'description': 'The message id', + }, + 'content': { + 'type': 'string', + 'description': 'The actual message', + }, + }, + }, + }, + }, + }, + 'CreateMessage': { + 'id': 'CreateMessage', + 'type': 'object', + 'description': 'Create a new message', 'properties': { 'message': { 'type': 'object', 'description': 'A single message', 'properties': { - 'id': { - 'type': 'integer', - 'description': 'The message id', - }, 'content': { 'type': 'string', 'description': 'The actual message', }, - } + }, }, }, - }, + } } @nickname('getMessages') + @validate_json_request('GetMessage') def get(self): """ Return a super users messages """ messages = list(model.message.get_messages()) @@ -861,6 +882,7 @@ class SuperUserMessages(ApiResource): @require_scope(scopes.SUPERUSER) @verify_not_prod @nickname('createMessages') + @validate_json_request('CreateMessage') def post(self): """ Create a message """ body = request.get_json()