Skip to content

Commit

Permalink
Fix redirects map object-form value validation (#7701)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jul 19, 2023
1 parent de65ad2 commit 019b797
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eleven-eyes-jog.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix redirects map object-form value validation
21 changes: 20 additions & 1 deletion packages/astro/src/core/config/schema.ts
Expand Up @@ -149,7 +149,26 @@ export const AstroConfigSchema = z.object({
.optional()
.default({})
),
redirects: z.record(z.string(), z.string()).default(ASTRO_CONFIG_DEFAULTS.redirects),
redirects: z
.record(
z.string(),
z.union([
z.string(),
z.object({
status: z.union([
z.literal(300),
z.literal(301),
z.literal(302),
z.literal(303),
z.literal(304),
z.literal(307),
z.literal(308),
]),
destination: z.string(),
}),
])
)
.default(ASTRO_CONFIG_DEFAULTS.redirects),
image: z
.object({
service: z.object({
Expand Down

0 comments on commit 019b797

Please sign in to comment.