Skip to content

Commit

Permalink
Merge branch 'main' into hd-sidebar-link-attributes
Browse files Browse the repository at this point in the history
* main:
  Replace copy/pasted `ImageFunction` with imported `SchemaContext` (withastro#775)
  • Loading branch information
HiDeoo committed Sep 28, 2023
2 parents 37b6149 + 2ef3036 commit 12d898a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-trains-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/starlight": patch
---

Fix content collection schema compatibility with Astro 3.1 and higher
20 changes: 2 additions & 18 deletions packages/starlight/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { z } from 'astro/zod';
import type { SchemaContext } from 'astro:content';
import { HeadConfigSchema } from './schemas/head';
import { PrevNextLinkConfigSchema } from './schemas/prevNextLink';
import { TableOfContentsSchema } from './schemas/tableOfContents';
Expand All @@ -10,25 +11,8 @@ export { i18nSchema } from './schemas/i18n';
type IconName = keyof typeof Icons;
const iconNames = Object.keys(Icons) as [IconName, ...IconName[]];

type ImageFunction = () => z.ZodObject<{
src: z.ZodString;
width: z.ZodNumber;
height: z.ZodNumber;
format: z.ZodUnion<
[
z.ZodLiteral<'png'>,
z.ZodLiteral<'jpg'>,
z.ZodLiteral<'jpeg'>,
z.ZodLiteral<'tiff'>,
z.ZodLiteral<'webp'>,
z.ZodLiteral<'gif'>,
z.ZodLiteral<'svg'>,
]
>;
}>;

export function docsSchema() {
return ({ image }: { image: ImageFunction }) =>
return ({ image }: SchemaContext) =>
z.object({
/** The title of the current page. Required. */
title: z.string(),
Expand Down

0 comments on commit 12d898a

Please sign in to comment.