Fix redirects map object-form value validation (#7701)

This commit is contained in:
Bjorn Lu 2023-07-19 15:52:50 +08:00 committed by GitHub
parent de65ad25ea
commit 019b797bf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix redirects map object-form value validation

View file

@ -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({