diff --git a/core/server/api/canary/utils/validators/input/schemas/webhooks-edit.json b/core/server/api/canary/utils/validators/input/schemas/webhooks-edit.json index 83bfc58aa3..bddc906e49 100644 --- a/core/server/api/canary/utils/validators/input/schemas/webhooks-edit.json +++ b/core/server/api/canary/utils/validators/input/schemas/webhooks-edit.json @@ -10,7 +10,64 @@ "type": "array", "minItems": 1, "maxItems": 1, - "items": {"$ref": "webhooks#/definitions/webhook"} + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "event": { + "type": "string", + "maxLength": 50, + "isLowercase": true + }, + "target_url": { + "type": "string", + "format": "uri-reference", + "maxLength": 2000 + }, + "name": { + "type": ["string", "null"], + "maxLength": 191 + }, + "secret": { + "type": ["string", "null"], + "maxLength": 191 + }, + "api_version": { + "type": ["string", "null"], + "maxLength": 50 + }, + "integration_id": { + "strip": true + }, + "id": { + "strip": true + }, + "status": { + "strip": true + }, + "last_triggered_at": { + "strip": true + }, + "last_triggered_status": { + "strip": true + }, + "last_triggered_error": { + "strip": true + }, + "created_at": { + "strip": true + }, + "created_by": { + "strip": true + }, + "updated_at": { + "strip": true + }, + "updated_by": { + "strip": true + } + } + } } }, "required": ["webhooks"] diff --git a/test/api-acceptance/admin/webhooks_spec.js b/test/api-acceptance/admin/webhooks_spec.js index 1d86bf6db7..d5678232ea 100644 --- a/test/api-acceptance/admin/webhooks_spec.js +++ b/test/api-acceptance/admin/webhooks_spec.js @@ -99,7 +99,8 @@ describe('Webhooks API', function () { webhooks: [{ name: 'Edit Test', event: 'subscriber.added', - target_url: 'https://example.com/new-subscriber' + target_url: 'https://example.com/new-subscriber', + integration_id: 'ignore_me' }] }) .expect(200)