fix: json validation

pull/9078/head
Agusti Fernandez Pardo 2022-05-18 19:21:48 +02:00
parent 957d6d2375
commit 35ebf53f19
1 changed files with 9 additions and 3 deletions

View File

@ -38,8 +38,8 @@ const schemaEventTypeCreateParams = z
slug: z.string(),
description: z.string().optional().nullable(),
length: z.number().int(),
// locations: jsonSchema.optional().nullable().or(z.null()),
// metadata: z.any().optional().nullable().nullish(),
locations: jsonSchema.optional().nullable().or(z.null()),
metadata: z.any().optional().nullable().or(z.null()),
recurringEvent: jsonSchema.optional().nullable().or(z.null()),
})
.strict();
@ -85,4 +85,10 @@ export const schemaEventTypeReadPublic = EventType.pick({
slotInterval: true,
successRedirectUrl: true,
description: true,
}).merge(z.object({ metadata: z.any(), locations: jsonSchema.or(z.null()) }));
}).merge(
z.object({
locations: jsonSchema.optional().nullable().or(z.null()),
metadata: z.any().optional().nullable().or(z.null()),
recurringEvent: jsonSchema.optional().nullable().or(z.null()),
})
);