Skip to content

Commit 87dd2bc

Browse files
committed
fix: update color regex to allow lowercase hex in OpenAPI schema
1 parent a549779 commit 87dd2bc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/openapi-schemas.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const createFolderRequestSchema = z
127127
.openapi({ example: "Work Projects", description: "Folder name (1-100 characters)" }),
128128
color: z
129129
.string()
130-
.regex(/^#[0-9A-F]{6}$/i)
130+
.regex(/^#[0-9A-Fa-f]{6}$/)
131131
.nullable()
132132
.optional()
133133
.openapi({ example: "#3b82f6", description: "Folder color (hex format #RRGGBB)" }),
@@ -154,7 +154,7 @@ export const updateFolderRequestSchema = z
154154
.openapi({ example: "Updated Folder Name", description: "Folder name (1-100 characters)" }),
155155
color: z
156156
.string()
157-
.regex(/^#[0-9A-F]{6}$/i)
157+
.regex(/^#[0-9A-Fa-f]{6}$/)
158158
.nullable()
159159
.optional()
160160
.openapi({ example: "#ef4444", description: "Folder color (hex format #RRGGBB)" }),

src/lib/validation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const createFolderSchema = z.object({
1111
name: z.string().min(1, "Folder name is required").max(100),
1212
color: z
1313
.string()
14-
.regex(/^#[0-9A-F]{6}$/i, "Invalid color format")
14+
.regex(/^#[0-9A-Fa-f]{6}$/, "Invalid color format")
1515
.optional(),
1616
parentId: z.string().uuid().optional(),
1717
isDefault: z.boolean().optional(),
@@ -21,7 +21,7 @@ export const updateFolderSchema = z.object({
2121
name: z.string().min(1).max(100).optional(),
2222
color: z
2323
.string()
24-
.regex(/^#[0-9A-F]{6}$/i)
24+
.regex(/^#[0-9A-Fa-f]{6}$/)
2525
.optional(),
2626
parentId: z.string().uuid().nullable().optional(),
2727
});

0 commit comments

Comments
 (0)