From 5c9b59f9e8c206860d21f8d281fbced4ed7207e8 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Tue, 6 Aug 2024 14:08:49 -0400 Subject: [PATCH] Refactor human readable errors for webhooks --- .../api/servers/server/webhooks/index.py | 41 ++++++++++++++++--- .../servers/server/webhooks/webhook/index.py | 41 ++++++++++++++++--- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/app/classes/web/routes/api/servers/server/webhooks/index.py b/app/classes/web/routes/api/servers/server/webhooks/index.py index 2557c309..851915de 100644 --- a/app/classes/web/routes/api/servers/server/webhooks/index.py +++ b/app/classes/web/routes/api/servers/server/webhooks/index.py @@ -16,16 +16,45 @@ new_webhook_schema = { "webhook_type": { "type": "string", "enum": WebhookFactory.get_supported_providers(), + "error": "typeString", + "fill": True, + }, + "name": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "url": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "bot_name": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "trigger": { + "type": "array", + "error": "typeString", + "fill": True, + }, + "body": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "color": { + "type": "string", + "default": "#005cd1", + "error": "typeString", + "fill": True, }, - "name": {"type": "string"}, - "url": {"type": "string"}, - "bot_name": {"type": "string"}, - "trigger": {"type": "array"}, - "body": {"type": "string"}, - "color": {"type": "string", "default": "#005cd1"}, "enabled": { "type": "boolean", "default": True, + "error": "typeBool", + "fill": True, }, }, "additionalProperties": False, diff --git a/app/classes/web/routes/api/servers/server/webhooks/webhook/index.py b/app/classes/web/routes/api/servers/server/webhooks/webhook/index.py index c94aa975..5578c3ed 100644 --- a/app/classes/web/routes/api/servers/server/webhooks/webhook/index.py +++ b/app/classes/web/routes/api/servers/server/webhooks/webhook/index.py @@ -17,16 +17,45 @@ webhook_patch_schema = { "webhook_type": { "type": "string", "enum": WebhookFactory.get_supported_providers(), + "error": "typeString", + "fill": True, + }, + "name": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "url": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "bot_name": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "trigger": { + "type": "array", + "error": "typeString", + "fill": True, + }, + "body": { + "type": "string", + "error": "typeString", + "fill": True, + }, + "color": { + "type": "string", + "default": "#005cd1", + "error": "typeString", + "fill": True, }, - "name": {"type": "string"}, - "url": {"type": "string"}, - "bot_name": {"type": "string"}, - "trigger": {"type": "array"}, - "body": {"type": "string"}, - "color": {"type": "string", "default": "#005cd1"}, "enabled": { "type": "boolean", "default": True, + "error": "typeBool", + "fill": True, }, }, "additionalProperties": False,