0
Fork 0
mirror of https://github.com/penpot/penpot-export.git synced 2025-01-19 21:22:28 -05:00

chore(core): disallow empty arrays in user config

This commit is contained in:
Roberto Redradix 2023-09-04 15:50:19 +02:00
parent 83ba6f93d5
commit f7b972e032

View file

@ -49,9 +49,21 @@ const userPagesConfigSchema = z.object({
const userFileConfigSchema = z
.object({
fileId: fileIdSchema,
colors: z.optional(z.array(userColorsConfigSchema)),
typographies: z.optional(z.array(userTypographiesConfigSchema)),
pages: z.optional(z.array(userPagesConfigSchema)),
colors: z.optional(
z
.array(userColorsConfigSchema)
.nonempty({ message: '.colors is required to have at least one item' }),
),
typographies: z.optional(
z.array(userTypographiesConfigSchema).nonempty({
message: '.typographies is required to have at least one item',
}),
),
pages: z.optional(
z
.array(userPagesConfigSchema)
.nonempty({ message: '.pages is required to have at least one item' }),
),
})
.refine(
(object) => {