From b237d71b2b53292028b123066a5a011547fefe5f Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Wed, 18 May 2022 17:46:22 +0200 Subject: [PATCH] fix: event type jsonschema or znull --- lib/validations/shared/jsonSchema.ts | 2 +- pages/api/hooks/[id].ts | 3 +++ pages/api/hooks/index.ts | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/validations/shared/jsonSchema.ts b/lib/validations/shared/jsonSchema.ts index bfc7ae1f2b..826f0b6250 100644 --- a/lib/validations/shared/jsonSchema.ts +++ b/lib/validations/shared/jsonSchema.ts @@ -5,5 +5,5 @@ type Literal = boolean | number | string; type Json = Literal | { [key: string]: Json } | Json[]; const literalSchema = z.union([z.string(), z.number(), z.boolean()]); export const jsonSchema: z.ZodSchema = z.lazy(() => - z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]) + z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]).or(z.null()) ); diff --git a/pages/api/hooks/[id].ts b/pages/api/hooks/[id].ts index dbdfc1a17e..32a81e7b12 100644 --- a/pages/api/hooks/[id].ts +++ b/pages/api/hooks/[id].ts @@ -26,6 +26,7 @@ export async function WebhookById( * /hooks/{id}: * get: * summary: Find a webhook + * operationId: getWebhookById * parameters: * - in: path * name: id @@ -64,6 +65,7 @@ export async function WebhookById( * /hooks/{id}: * patch: * summary: Edit an existing webhook + * operationId: editWebhookById * parameters: * - in: path * name: id @@ -109,6 +111,7 @@ export async function WebhookById( * /hooks/{id}: * delete: * summary: Remove an existing hook + * operationId: removeWebhookById * parameters: * - in: path * name: id diff --git a/pages/api/hooks/index.ts b/pages/api/hooks/index.ts index ccda5dcd76..0a81da7ec5 100644 --- a/pages/api/hooks/index.ts +++ b/pages/api/hooks/index.ts @@ -16,6 +16,7 @@ async function createOrlistAllWebhooks( * /hooks: * get: * summary: Find all webhooks + * operationId: listWebhooks * tags: * - hooks * externalDocs: @@ -43,6 +44,7 @@ async function createOrlistAllWebhooks( * /hooks: * post: * summary: Creates a new webhook + * operationId: addWebhook * tags: * - webhooks * externalDocs: